Skip to content

Modified Localization simplifies the localization process, saving time and ensuring accuracy. Expand your app's accessibility and connect with users worldwide with Modified Localization.

License

Notifications You must be signed in to change notification settings

xaldarof/modified-localization

Repository files navigation

pub package

example

Run in terminal : flutter pub run modified_localization:generate -o locale_keys.g.dart --source-dir /your_dir

example/resources/langs/en-EN.json

{
  "hi": "Hi !",
  "welcome": "Welcome {}"
}

Will be generated strings class like this, then you can use it without .tr(), if arguments needed will be generated args function

abstract class Strings {
  static String get hi => 'hi'.tr();

  static String welcome(String arg0) {
    return 'welcome'.tr(args: [arg0]);
  }
}
class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(Strings.hi),
            Text(Strings.welcome("Flutter")),
          ],
        ),
        alignment: Alignment.center,
      ),
    );
  }
}

About

Modified Localization simplifies the localization process, saving time and ensuring accuracy. Expand your app's accessibility and connect with users worldwide with Modified Localization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published