Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: language support added for es, pt, mandarin and cantonese #949

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/at_onboarding_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
## 6.1.10

- **FEAT** Language support added for:
- Spanish (Latin America)
- Portuguese
- Brazilian Portuguese
- Mandarin
- Cantonese

## 6.1.9

- build[deps]: Upgraded dependencies for the following packages:
- at_client: 3.2.2
- at_client_mobile: 3.2.19
- at_auth: 2.0.7
- at_commons: 5.0.0
- at_utils: 3.0.19

## 6.1.8

- **CHORE**: Updated dependencies
Expand Down
37 changes: 28 additions & 9 deletions packages/at_onboarding_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class MyAppState extends State<MyApp> {

bool isChangeLanguage = false;
var _currentLocale = const Locale('en', '');
final frenchLocale = const Locale('fr');
final englishLocale = const Locale('en');
final spanishLocale = const Locale('es');
final portugueseLocale = const Locale('pt');
final brazillianPortugueseLocale = const Locale('pt', 'BR');
final chineseTraditionalLocale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: 'HK');
final chineseSimplifiedLocale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN');

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -67,9 +74,14 @@ class MyAppState extends State<MyApp> {
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('fr'),
Locale('en'),
supportedLocales: [
englishLocale,
frenchLocale,
spanishLocale,
portugueseLocale,
brazillianPortugueseLocale,
chineseTraditionalLocale,
chineseSimplifiedLocale,
],
themeMode: themeMode,
home: Scaffold(
Expand Down Expand Up @@ -177,16 +189,23 @@ class MyAppState extends State<MyApp> {
children: <Widget>[
const Text("Change language:"),
const SizedBox(width: 10),
DropdownButton(
DropdownButton<Locale>(
onChanged: (value) {
setState(() {
value == 'en' ? _currentLocale = const Locale('en') : _currentLocale = const Locale('fr');
_currentLocale = value!;
});
},
value: _currentLocale.languageCode,
items: const [
DropdownMenuItem(value: 'en', child: Text('English')),
DropdownMenuItem(value: 'fr', child: Text('French')),
value: _currentLocale,
items: [
DropdownMenuItem(value: englishLocale, child: const Text('English')),
DropdownMenuItem(value: frenchLocale, child: const Text('French')),
DropdownMenuItem(value: spanishLocale, child: const Text('Spanish')),
DropdownMenuItem(value: portugueseLocale, child: const Text('Portuguese')),
DropdownMenuItem(
value: brazillianPortugueseLocale, child: const Text('Brazilian Portuguese')),
DropdownMenuItem(
value: chineseTraditionalLocale, child: const Text('Chinese (Traditional)')),
DropdownMenuItem(value: chineseSimplifiedLocale, child: const Text('Chinese (Simplified)')),
XavierChanth marked this conversation as resolved.
Show resolved Hide resolved
],
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import path_provider_foundation
import share_plus
import shared_preferences_foundation
import url_launcher_macos
import webview_flutter_wkwebview

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin"))
Expand All @@ -25,4 +26,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin"))
}
17 changes: 12 additions & 5 deletions packages/at_onboarding_flutter/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ PODS:
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- at_file_saver (from `Flutter/ephemeral/.symlinks/plugins/at_file_saver/macos`)
Expand All @@ -32,6 +35,7 @@ DEPENDENCIES:
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- webview_flutter_wkwebview (from `Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin`)

EXTERNAL SOURCES:
at_file_saver:
Expand All @@ -54,19 +58,22 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
webview_flutter_wkwebview:
:path: Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin

SPEC CHECKSUMS:
at_file_saver: 1fc6ed722f17c7a20ce79cce168d1100fcad4b95
biometric_storage: 43caa6e7ef00e8e19c074216e7e1786dacda9e76
device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2
file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
package_info_plus: d2f71247aab4b6521434f887276093acc70d214c
package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
share_plus: a182a58e04e51647c0481aadabbc4de44b3a2bce
share_plus: 1fa619de8392a4398bfaf176d441853922614e89
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
7 changes: 3 additions & 4 deletions packages/at_onboarding_flutter/lib/at_onboarding_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ library at_onboarding_flutter;
export 'package:at_backupkey_flutter/at_backupkey_flutter.dart';
export 'package:at_client_mobile/at_client_mobile.dart';

// Additional customizations
export 'generated/l10n.dart';
// Core package requirements
export 'src/at_onboarding.dart';
export 'src/at_onboarding_result.dart';
export 'src/utils/at_onboarding_app_constants.dart' show RootEnvironment;
export 'src/services/at_onboarding_config.dart';

// Additional customizations
export './localizations/generated/l10n.dart';
export 'src/services/at_onboarding_theme.dart';
export 'src/utils/at_onboarding_app_constants.dart' show RootEnvironment;
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,44 @@ import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';

import 'messages_en.dart' as messages_en;
import 'messages_es.dart' as messages_es;
import 'messages_fr.dart' as messages_fr;
import 'messages_pt.dart' as messages_pt;
import 'messages_pt_BR.dart' as messages_pt_br;
import 'messages_zh.dart' as messages_zh;
import 'messages_zh_Hans_CH.dart' as messages_zh_hans_ch;
import 'messages_zh_Hant_HK.dart' as messages_zh_hant_hk;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'es': () => new SynchronousFuture(null),
'fr': () => new SynchronousFuture(null),
'pt': () => new SynchronousFuture(null),
'pt_BR': () => new SynchronousFuture(null),
'zh': () => new SynchronousFuture(null),
'zh_Hans_CH': () => new SynchronousFuture(null),
'zh_Hant_HK': () => new SynchronousFuture(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'es':
return messages_es.messages;
case 'fr':
return messages_fr.messages;
case 'pt':
return messages_pt.messages;
case 'pt_BR':
return messages_pt_br.messages;
case 'zh':
return messages_zh.messages;
case 'zh_Hans_CH':
return messages_zh_hans_ch.messages;
case 'zh_Hant_HK':
return messages_zh_hant_hk.messages;
default:
return null;
}
Expand Down
Loading