polyglothq 1.1.2 polyglothq: ^1.1.2 copied to clipboard
polyglothq is a Dart CLI to support using Polyglot for Flutter projects. polyglothq fetches translations from polyglothq.com, and converts them to a Flutter-suitable form.
import 'package:example/util/localization/strings.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Polyglot Demo',
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text(Strings.of(context).appName),
),
);
}
}