modified_localization

Last updated:

0 purchases

modified_localization Image
modified_localization Images
Add to Cart

Description:

modified localization

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 {}"
}
copied to clipboard
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]);
}
}
copied to clipboard
example/lib/main.dart #
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,
),
);
}
}

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.