excel_localization 0.0.2 copy "excel_localization: ^0.0.2" to clipboard
excel_localization: ^0.0.2 copied to clipboard

outdated

This excel localization is project that user can use to generate variable values for using localisation. and manage localization without context.

example/lib/main.dart

import 'package:excel_localization_example/i18n.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:excel_localization/excel_localization.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // dont forget to add if you like to access by global context
      navigatorKey: I18n.languageKey,

      localizationsDelegates: const [
        I18nDelegate(),
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: I18nDelegate.supportedLocals,
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Center(
          child: Column(
            children: <Widget>[
              Text(I18n.translate.welcome(name: "hardy")),
              // get language by passsing context
              Text(I18n.of(context).plainText),
              // global context also can use
              Text(I18n.of(I18n.languageKey.currentState!.context)
                  .welcome(name: "Hello dada")),

              OutlinedButton(
                  onPressed: () {
                    setState(() {
                      I18n.load(Locale("fr"));
                    });
                  },
                  child: Text("click here"))
            ],
          ),
        ),
      ),
    );
  }
}
21
likes
0
pub points
36%
popularity

Publisher

unverified uploader

This excel localization is project that user can use to generate variable values for using localisation. and manage localization without context.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

csv, dart_style, excel, flutter, flutter_localizations, flutter_web_plugins, meta, yaml

More

Packages that depend on excel_localization