Add app localization
This commit is contained in:
parent
a589cdaee3
commit
5b14d58b1f
6 changed files with 30 additions and 2 deletions
3
l10n.yaml
Normal file
3
l10n.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
arb-dir: lib/l10n
|
||||
template-arb-file: app_en.arb
|
||||
output-localization-file: app_localizations.dart
|
||||
3
lib/l10n/app_en.arb
Normal file
3
lib/l10n/app_en.arb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"mainTitle": "Traccar Client"
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:traccar_client/main_screen.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'main_screen.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MainApp());
|
||||
|
|
@ -11,6 +13,8 @@ class MainApp extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: MainScreen(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'status_screen.dart';
|
||||
import 'settings_screen.dart';
|
||||
|
|
@ -10,7 +11,7 @@ class MainScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Main Screen'),
|
||||
title: Text(AppLocalizations.of(context)!.mainTitle),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
|
|
|
|||
13
pubspec.lock
13
pubspec.lock
|
|
@ -150,6 +150,11 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
flutter_localizations:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
@ -160,6 +165,14 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.19.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ environment:
|
|||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
intl: any
|
||||
flutter_background_geolocation: ^4.16.9
|
||||
shared_preferences: ^2.5.3
|
||||
firebase_core: ^3.13.0
|
||||
|
|
@ -21,3 +24,4 @@ dev_dependencies:
|
|||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
generate: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue