floca 0.1.1-alpha copy "floca: ^0.1.1-alpha" to clipboard
floca: ^0.1.1-alpha copied to clipboard

outdated

Library for Flutter app localization. Generates Dart code with string constants, ready to plug into MaterialApp.

Install #

Update pubspec.yaml:

dependencies:
  floca: any

Get:

$ flutter pub get

Check it runs:

$ flutter pub run floca:floca --help

Use #

1. Create the spreadsheet

property en es ru hi
greeting hi! hola! привет! हाय!
farewell bye adiós пока अलविदा

Save it as .csv file, say, string_constants.csv.

2. Generate a .dart file from it

$ flutter pub run floca:floca string_constants.csv string_constants.dart

3. Provide arguments to MaterialApp

import 'string_constants.dart'; // file we created with floca

MaterialApp(
  ...
  supportedLocales: supportedLocales, // add this
  localizationsDelegates: localizationsDelegates, // and this
  ...
);

4. Get localized text in your app

import 'string_constants.dart'; // file we created with floca

Widget build(BuildContext context) {
  // now [context] has a new property [.i18n]  
  String s = context.i18n.greeting;
  return Text(s); 
}
2
likes
0
pub points
0%
popularity

Publisher

verified publisherrevercode.com

Library for Flutter app localization. Generates Dart code with string constants, ready to plug into MaterialApp.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

csv, flutter, flutter_localizations, intl

More

Packages that depend on floca