4

As mentioned in GetX Documations to use GetX Localization I should create a messages.dart file that contains a map for every language as this one :

import 'package:get/get.dart';

class Messages extends Translations {
  @override
  Map<String, Map<String, String>> get keys => {
        'en_US': {
          'hello': 'Hello World',
        },
        'de_DE': {
          'hello': 'Hallo Welt',
        }
      };
}

Then call the value of every string using the .tr method like "hello".tr and it will show the value based on the current locale.

Now in my case the process is reversed as I have a complete flutter application that has all strings written as "String".tr and I need a way to list all strings and generate a JSON map out of it .. or even list all strings then I will manually create the messages.dart file.

Ahmed Wagdi
  • 3,913
  • 10
  • 50
  • 116

0 Answers0