在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):msayed-net/localize_and_translate开源软件地址(OpenSource Url):https://github.com/msayed-net/localize_and_translate开源编程语言(OpenSource Language):Dart 81.4%开源软件介绍(OpenSource Introduction):localize_and_translateFlutter localization in easy steps ScreenshotsTutorialVideo
Methods
Installation
{
"appTitle": "تطبيق تجريبى",
"buttonTitle": "English",
"textArea": "هذا مجرد نموذج للتأكد من اداء الأداة"
}
flutter:
assets:
- assets/lang/ Initialization
import 'package:flutter/material.dart';
import 'package:localize_and_translate/localize_and_translate.dart';
main() async {
// if your flutter > 1.7.8 : ensure flutter activated
WidgetsFlutterBinding.ensureInitialized();
await translator.init(
localeType: LocalizationDefaultType.device,
languagesList: <String>['ar', 'en'],
assetsDirectory: 'assets/lang/',
);
runApp(
LocalizedApp(
child: MyApp(),
),
);
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Home(),
localizationsDelegates: translator.delegates, // Android + iOS Delegates
locale: translator.locale, // Active locale
supportedLocales: translator.locals(), // Locals list
);
}
} Usage
ExampleContributors |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论