katana_localization 2.3.8 copy "katana_localization: ^2.3.8" to clipboard
katana_localization: ^2.3.8 copied to clipboard

A multilingual package that automatically creates code that can retrieve data from Google spreadsheets and write type-safe code with method chaining.

example/lib/main.dart

// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:katana_localization/katana_localization.dart';

part 'main.localize.dart';

final l = AppLocalize();

@GoogleSpreadSheetLocalize(
  [
    "https://docs.google.com/spreadsheets/d/1bw7IXEr7BGkZ4U6on0OuF7HQkTMgDSm6u5ThpBkDPeo/edit#gid=551986808"
  ],
  version: 1,
)
class AppLocalize extends _$AppLocalize {}

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return LocalizeScope(
      localize: l,
      builder: (context, localize) {
        return MaterialApp(
          locale: localize.locale,
          localizationsDelegates: localize.delegates(),
          supportedLocales: localize.supportedLocales(),
          localeResolutionCallback: localize.localeResolutionCallback(),
          home: MainPage(),
          title: "Flutter Demo",
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
        );
      },
    );
  }
}

// ignore: use_key_in_widget_constructors
class MainPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(l().appTitle)),
      body: ListView(
        children: [
          ListTile(
            title: Text(l.locale.toLanguageTag()),
          ),
          ListTile(
            title: Text(l().ok),
          ),
          ListTile(
            title: Text(l().cancel),
          ),
          ListTile(
            title: Text(
              l().$(l().$(l().process).of.$(l().data)).hasBeenCompleted,
            ),
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        child: const Icon(Icons.change_circle),
        onPressed: () {
          l.setCurrentLocale(
            l.supportedLocales().firstWhere((element) => element != l.locale),
          );
        },
      ),
    );
  }
}
3
likes
140
pub points
66%
popularity

Publisher

verified publishermathru.net

A multilingual package that automatically creates code that can retrieve data from Google spreadsheets and write type-safe code with method chaining.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, katana, katana_localization_annotation

More

Packages that depend on katana_localization