Remove i18n package. Add xml files with strings to flutter assets. Create method for passing localized strings to channel.
This commit is contained in:
@@ -4,7 +4,8 @@ import 'package:checker/db.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T> {
|
||||
abstract class SettingsBaseState<T extends StatefulWidget>
|
||||
extends BaseState<T> {
|
||||
|
||||
SettingsBaseState(SqliteHelper helper, String app) {
|
||||
this.helper = helper;
|
||||
@@ -15,7 +16,7 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return new Scaffold(appBar: getAppBar(),
|
||||
body: getScreenContent());
|
||||
body: getScreenContent());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -43,26 +44,27 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
|
||||
|
||||
Widget getItem(String option) {
|
||||
return new Container(
|
||||
height: 56.0,
|
||||
child: (new FlatButton(onPressed: () {
|
||||
height: 56.0,
|
||||
child: (new FlatButton(onPressed: () {
|
||||
setState(() {
|
||||
saveOption();
|
||||
setState(() {
|
||||
selectedItem = getOptions().indexOf(option);
|
||||
});
|
||||
},
|
||||
child: new Row(children: <Widget>[
|
||||
new Expanded(child: new Text(option)),
|
||||
getCheckMark(getOptions().indexOf(option))]))));
|
||||
selectedItem = getOptions().indexOf(option);
|
||||
});
|
||||
},
|
||||
child: new Row(children: <Widget>[
|
||||
new Expanded(child: new Text(option)),
|
||||
getCheckMark(getOptions().indexOf(option))
|
||||
]))));
|
||||
}
|
||||
|
||||
Widget getCheckMark(int index) {
|
||||
return index == selectedItem ? new Image.asset(check_png,
|
||||
width: 28.0,
|
||||
height: 28.0) : new Image.asset(check_png, color: new Color(0xffffff));
|
||||
width: 28.0,
|
||||
height: 28.0) : new Image.asset(check_png, color: new Color(0xffffff));
|
||||
}
|
||||
|
||||
@override
|
||||
String getTitle() {
|
||||
return StringsLocalization.settings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:checker/screens/splash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'db.dart';
|
||||
import 'dart:convert';
|
||||
@@ -46,9 +45,8 @@ logout(BuildContext context, SqliteHelper helper) async {
|
||||
helper.clear().then((result) {
|
||||
// helper.close().then((_) {
|
||||
// Navigator.of(context).pop();
|
||||
// Navigator.of(context).pop();
|
||||
pushRouteReplacement(
|
||||
context, new SplashScreen()); // Запускаем регистрацию
|
||||
Navigator.of(context).pop();
|
||||
pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию
|
||||
// });
|
||||
});
|
||||
}).catchError((error) {
|
||||
@@ -162,13 +160,16 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
}
|
||||
});
|
||||
|
||||
platform.invokeMethod('startScanner', {
|
||||
Map<String, String> args = StringsLocalization.strings;
|
||||
args.addAll({
|
||||
'token': token,
|
||||
'url': await platform.invokeMethod('getEndpoint'),
|
||||
'appToken': await platform.invokeMethod('getAppToken'),
|
||||
'locale': Intl.defaultLocale,
|
||||
'color': Resources.getPrimaryColor(app).value
|
||||
'locale': StringsLocalization.localeCode,
|
||||
'color': Resources.getPrimaryColor(app).value.toString()
|
||||
});
|
||||
|
||||
platform.invokeMethod('startScanner', args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that looks up messages for specific locales by
|
||||
// delegating to the appropriate library.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
import 'package:intl/src/intl_helpers.dart';
|
||||
|
||||
import 'messages_en.dart' as messages_messages_en;
|
||||
import 'messages_es.dart' as messages_messages_es;
|
||||
import 'messages_ru.dart' as messages_messages_ru;
|
||||
import 'messages_ua.dart' as messages_messages_ua;
|
||||
|
||||
typedef Future<dynamic> LibraryLoader();
|
||||
Map<String, LibraryLoader> _deferredLibraries = {
|
||||
'en': () => new Future.value(null),
|
||||
'es': () => new Future.value(null),
|
||||
'ru': () => new Future.value(null),
|
||||
'ua': () => new Future.value(null),
|
||||
};
|
||||
|
||||
MessageLookupByLibrary _findExact(localeName) {
|
||||
switch (localeName) {
|
||||
case 'en':
|
||||
return messages_messages_en.messages;
|
||||
case 'es':
|
||||
return messages_messages_es.messages;
|
||||
case 'ru':
|
||||
return messages_messages_ru.messages;
|
||||
case 'ua':
|
||||
return messages_messages_ua.messages;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// User programs should call this before using [localeName] for messages.
|
||||
Future initializeMessages(String localeName) {
|
||||
var lib = _deferredLibraries[Intl.canonicalizedLocale(localeName)];
|
||||
var load = lib == null ? new Future.value(false) : lib();
|
||||
return load.then((_) {
|
||||
initializeInternalMessageLookup(() => new CompositeMessageLookup());
|
||||
messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
|
||||
});
|
||||
}
|
||||
|
||||
bool _messagesExistFor(String locale) {
|
||||
var messages;
|
||||
try {
|
||||
messages = _findExact(locale);
|
||||
} catch (e) {}
|
||||
return messages != null;
|
||||
}
|
||||
|
||||
MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
|
||||
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
|
||||
onFailure: (_) => null);
|
||||
if (actualLocale == null) return null;
|
||||
return _findExact(actualLocale);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a messages_en locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
final _keepAnalysisHappy = Intl.defaultLocale;
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
get localeName => 'messages_en';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => {
|
||||
"ID_Store" : MessageLookupByLibrary.simpleMessage("Store ID"),
|
||||
"ID_not_found" : MessageLookupByLibrary.simpleMessage("Identifier %s is not found"),
|
||||
"app_activ" : MessageLookupByLibrary.simpleMessage("The application is activated"),
|
||||
"ask_change_store" : MessageLookupByLibrary.simpleMessage("Do you really want to log out and enter a different store number?"),
|
||||
"buyer" : MessageLookupByLibrary.simpleMessage("Buyer"),
|
||||
"card" : MessageLookupByLibrary.simpleMessage("Card"),
|
||||
"card_scaner" : MessageLookupByLibrary.simpleMessage("Card Scanner"),
|
||||
"carry_purchase" : MessageLookupByLibrary.simpleMessage("Create a purchase"),
|
||||
"complite_activ" : MessageLookupByLibrary.simpleMessage("Complete registration"),
|
||||
"complite_purchase" : MessageLookupByLibrary.simpleMessage("Complete the purchase"),
|
||||
"confirm_purchase" : MessageLookupByLibrary.simpleMessage("You confirm the purchase for %s %s"),
|
||||
"confirmation" : MessageLookupByLibrary.simpleMessage("Сonfirmation"),
|
||||
"no" : MessageLookupByLibrary.simpleMessage("No"),
|
||||
"purchase_complite" : MessageLookupByLibrary.simpleMessage("A purchase of %s %s was completed"),
|
||||
"registration" : MessageLookupByLibrary.simpleMessage("Registration"),
|
||||
"usage" : MessageLookupByLibrary.simpleMessage("Usage"),
|
||||
"support" : MessageLookupByLibrary.simpleMessage("Support contacts"),
|
||||
"common" : MessageLookupByLibrary.simpleMessage("General information"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Activation request for the application has been sent, please wait for administrator approval"),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Reward"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Bonus on account"),
|
||||
"discount_rate" : MessageLookupByLibrary.simpleMessage("Dicount Rate"),
|
||||
"discount_sum" : MessageLookupByLibrary.simpleMessage("Dicount Sum"),
|
||||
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Bonus points"),
|
||||
"bonus_minus" : MessageLookupByLibrary.simpleMessage("Bonus was charged"),
|
||||
"bonus_hint" : MessageLookupByLibrary.simpleMessage("Points to charge"),
|
||||
"coupons_used" : MessageLookupByLibrary.simpleMessage("Coupons were used"),
|
||||
"select_coupons" : MessageLookupByLibrary.simpleMessage("Select coupons for using in purchase"),
|
||||
"bonus_explanation" : MessageLookupByLibrary.simpleMessage("If not set, points will be added"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Scan"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Sign Up"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Specify the store ID"),
|
||||
"sum" : MessageLookupByLibrary.simpleMessage("Sum"),
|
||||
"update_activ_status" : MessageLookupByLibrary.simpleMessage("Update activation status"),
|
||||
"yes" : MessageLookupByLibrary.simpleMessage("Yes"),
|
||||
"settings" : MessageLookupByLibrary.simpleMessage("Settings"),
|
||||
"help" : MessageLookupByLibrary.simpleMessage("Help"),
|
||||
"exit" : MessageLookupByLibrary.simpleMessage("Exit"),
|
||||
"logout" : MessageLookupByLibrary.simpleMessage("Log Out"),
|
||||
"currency" : MessageLookupByLibrary.simpleMessage("Currency"),
|
||||
"locale" : MessageLookupByLibrary.simpleMessage("Language"),
|
||||
"nominative_ruble": MessageLookupByLibrary.simpleMessage("Ruble"),
|
||||
"singular_ruble": MessageLookupByLibrary.simpleMessage("Ruble"),
|
||||
"plural_ruble": MessageLookupByLibrary.simpleMessage("Rubles"),
|
||||
"nominative_dollar": MessageLookupByLibrary.simpleMessage("US Dollar"),
|
||||
"singular_dollar": MessageLookupByLibrary.simpleMessage("US Dollar"),
|
||||
"plural_dollar": MessageLookupByLibrary.simpleMessage("US Dollars"),
|
||||
"nominative_hryvna": MessageLookupByLibrary.simpleMessage("Hryvnia"),
|
||||
"singular_hryvna": MessageLookupByLibrary.simpleMessage("Hryvnia"),
|
||||
"plural_hryvna": MessageLookupByLibrary.simpleMessage("Hryvnia"),
|
||||
"nominative_tenge": MessageLookupByLibrary.simpleMessage("Tenge"),
|
||||
"singular_tenge": MessageLookupByLibrary.simpleMessage("Tenge"),
|
||||
"plural_tenge": MessageLookupByLibrary.simpleMessage("Tenge"),
|
||||
"nominative_euro": MessageLookupByLibrary.simpleMessage("Euro"),
|
||||
"singular_euro": MessageLookupByLibrary.simpleMessage("Euro"),
|
||||
"plural_euro": MessageLookupByLibrary.simpleMessage("Euro"),
|
||||
"registration_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Store log in screen is the first thing you will see after starting the application.
|
||||
|
||||
Enter the store number (ID). You can look it up in the loyalty program control panel. If you do not have access to the control panel, ask the administrator.
|
||||
|
||||
Click the ""Login"" button.
|
||||
|
||||
Please wait while the administrator activates your request. You can refresh your store activation status by pressing the ""Update activation status"" button.
|
||||
|
||||
After the administrator activates your request, click the ""Complete activation"" button. The application is ready to use.
|
||||
|
||||
If you want to log in as another store, click the Menu button (upper right corner of the screen) and select "Exit".
|
||||
'''),
|
||||
"usage_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Step 1:
|
||||
|
||||
Launch this application and scan your customer's loyalty card using the built in scanner.
|
||||
|
||||
If the scan is successful, the customer's information will appear on the screen.
|
||||
|
||||
Step 2:
|
||||
|
||||
Enter the purchase amount and click the ""Create a purchase"" button.
|
||||
|
||||
In a pop-up window press ""YES"" to confirm the amount and allot the points to a customer.
|
||||
|
||||
If you want to correct the amount, press ""NO"" and you will return back to the purchase screen where you can adjust the amount.
|
||||
'''),
|
||||
"support_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Always recommend your customers to install your loyalty card app, so they can participate in your loyalty program.
|
||||
|
||||
If you have any problems with the application, feel free to contact the support.
|
||||
|
||||
Phone:\n%s\n
|
||||
Our website:\n%s'''),
|
||||
"common_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
To improve barcode scanning quality, adjust the distance between the camera and the barcode so that the border around the barcode (if any) is not visible. Otherwise the vertical lines of the border could be wrongly considered as part of the code.''')
|
||||
};
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a messages_es locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
final _keepAnalysisHappy = Intl.defaultLocale;
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
get localeName => 'messages_es';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => {
|
||||
"ID_Store" : MessageLookupByLibrary.simpleMessage("ID del negocio "),
|
||||
"ID_not_found" : MessageLookupByLibrary.simpleMessage("ID %s no está encontrado"),
|
||||
"app_activ" : MessageLookupByLibrary.simpleMessage("Aplicación está activada"),
|
||||
"ask_change_store" : MessageLookupByLibrary.simpleMessage("¿Os realmente quiereis acabarse una sesión y dar otro DIN del negocio?"),
|
||||
"buyer" : MessageLookupByLibrary.simpleMessage("El comprador"),
|
||||
"card" : MessageLookupByLibrary.simpleMessage("Tarjeta"),
|
||||
"card_scaner" : MessageLookupByLibrary.simpleMessage("El escaneo de tarjeta"),
|
||||
"carry_purchase" : MessageLookupByLibrary.simpleMessage("Realizar la compra"),
|
||||
"complite_activ" : MessageLookupByLibrary.simpleMessage("Terminar el registro"),
|
||||
"complite_purchase" : MessageLookupByLibrary.simpleMessage("Terminar la compra"),
|
||||
"confirm_purchase" : MessageLookupByLibrary.simpleMessage("¿Confirmais la compra por %s %s"),
|
||||
"confirmation" : MessageLookupByLibrary.simpleMessage("Confirmacón"),
|
||||
"no" : MessageLookupByLibrary.simpleMessage("No"),
|
||||
"purchase_complite" : MessageLookupByLibrary.simpleMessage("La compra por %s %s está realizada"),
|
||||
"registration" : MessageLookupByLibrary.simpleMessage("El registro"),
|
||||
"usage" : MessageLookupByLibrary.simpleMessage("Explotación"),
|
||||
"support" : MessageLookupByLibrary.simpleMessage("Los contactos del soporte técnico"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("El requieremento de activación de aplicación esta mandado, esperad la activación por el administrador."),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Gratificación"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Bono por cuenta"),
|
||||
"discount_rate" : MessageLookupByLibrary.simpleMessage("Tasa de descuento"),
|
||||
"discount_sum" : MessageLookupByLibrary.simpleMessage("El monto del descuento"),
|
||||
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Puntos de bonificación"),
|
||||
"bonus_minus" : MessageLookupByLibrary.simpleMessage("El bono fue cobrado"),
|
||||
"bonus_hint" : MessageLookupByLibrary.simpleMessage("¿Cuántas puntuaciones se cancelan?"),
|
||||
"coupons_used" : MessageLookupByLibrary.simpleMessage("Los cupones fueron canjeados"),
|
||||
"bonus_explanation" : MessageLookupByLibrary.simpleMessage("Si no especifica cuántos puntos cancelar, se agregarán puntos"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Escanear"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Registrarse"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Hay que dar ID del negocio"),
|
||||
"sum" : MessageLookupByLibrary.simpleMessage("Suma"),
|
||||
"update_activ_status" : MessageLookupByLibrary.simpleMessage("Actualizar la condición de activación"),
|
||||
"user_name" : MessageLookupByLibrary.simpleMessage("Un nombre de usario"),
|
||||
"yes" : MessageLookupByLibrary.simpleMessage("Si"),
|
||||
"settings" : MessageLookupByLibrary.simpleMessage("Las configuraciones"),
|
||||
"help" : MessageLookupByLibrary.simpleMessage("La Ayuda"),
|
||||
"exit" : MessageLookupByLibrary.simpleMessage("Salir"),
|
||||
"logout" : MessageLookupByLibrary.simpleMessage("Log Out"),
|
||||
"currency" : MessageLookupByLibrary.simpleMessage("La Moneda"),
|
||||
"locale" : MessageLookupByLibrary.simpleMessage("La lengua"),
|
||||
"nominative_ruble": MessageLookupByLibrary.simpleMessage("Rublo"),
|
||||
"singular_ruble": MessageLookupByLibrary.simpleMessage("Rublo"),
|
||||
"plural_ruble": MessageLookupByLibrary.simpleMessage("Rublos"),
|
||||
"nominative_dollar": MessageLookupByLibrary.simpleMessage("Dólar Dolares"),
|
||||
"singular_dollar": MessageLookupByLibrary.simpleMessage("Dólar Dolares"),
|
||||
"plural_dollar": MessageLookupByLibrary.simpleMessage("Dólar Dolares"),
|
||||
"nominative_hryvna": MessageLookupByLibrary.simpleMessage("Hryvnia"),
|
||||
"singular_hryvna": MessageLookupByLibrary.simpleMessage("Hryvnia"),
|
||||
"plural_hryvna": MessageLookupByLibrary.simpleMessage("Hryvnia"),
|
||||
"nominative_tenge": MessageLookupByLibrary.simpleMessage("Tenge"),
|
||||
"singular_tenge": MessageLookupByLibrary.simpleMessage("Tenge"),
|
||||
"plural_tenge": MessageLookupByLibrary.simpleMessage("Tenge"),
|
||||
"nominative_euro": MessageLookupByLibrary.simpleMessage("Euro"),
|
||||
"singular_euro": MessageLookupByLibrary.simpleMessage("Euro"),
|
||||
"plural_euro": MessageLookupByLibrary.simpleMessage("Euro"),
|
||||
"registration_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Store log in screen is the first thing you will see after starting the application.
|
||||
|
||||
Enter the store number (DIN). You can look it up in the loyalty program control panel. If you do not have access to the control panel, ask the administrator.
|
||||
|
||||
Click the ""Login"" button.
|
||||
|
||||
Please wait while the administrator activates your request. You can refresh your store activation status by pressing the ""Update activation status"" button.
|
||||
|
||||
After the administrator activates your request, click the ""Complete activation"" button. The application is ready to use.
|
||||
|
||||
If you want to log in as another store, click the Menu button (upper right corner of the screen) and select "Exit".
|
||||
'''),
|
||||
"usage_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Step 1:
|
||||
|
||||
Launch this application and scan your customer's loyalty card using the built in scanner.
|
||||
|
||||
If the scan is successful, the customer's information will appear on the screen.
|
||||
|
||||
Step 2:
|
||||
|
||||
Enter the purchase amount and click the ""Create a purchase"" button.
|
||||
|
||||
In a pop-up window press ""YES"" to confirm the amount and allot the points to a customer.
|
||||
|
||||
If you want to correct the amount, press ""NO"" and you will return back to the purchase screen where you can adjust the amount.
|
||||
'''),
|
||||
"support_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Always recommend your customers to install your loyalty card app, so they can participate in your loyalty program.
|
||||
|
||||
If you have any problems with the application, feel free to contact the support.
|
||||
|
||||
Phone:\n%s\n
|
||||
Our website:\n%s'''),
|
||||
"common_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
To improve barcode scanning quality, adjust the distance between the camera and the barcode so that the border around the barcode (if any) is not visible. Otherwise the vertical lines of the border could be wrongly considered as part of the code.''')
|
||||
};
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a messages_ru locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
final _keepAnalysisHappy = Intl.defaultLocale;
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
get localeName => 'messages_ru';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => {
|
||||
"ID_Store" : MessageLookupByLibrary.simpleMessage("ID магазина"),
|
||||
"ID_not_found" : MessageLookupByLibrary.simpleMessage("Идентификатор %s не найден"),
|
||||
"app_activ" : MessageLookupByLibrary.simpleMessage("Приложение активировано"),
|
||||
"ask_change_store" : MessageLookupByLibrary.simpleMessage("Вы действительно хотите выйти и ввести другой номер магазина?"),
|
||||
"buyer" : MessageLookupByLibrary.simpleMessage("Покупатель"),
|
||||
"card" : MessageLookupByLibrary.simpleMessage("Карта"),
|
||||
"card_scaner" : MessageLookupByLibrary.simpleMessage("Сканер карты"),
|
||||
"carry_purchase" : MessageLookupByLibrary.simpleMessage("Проведение покупки"),
|
||||
"complite_activ" : MessageLookupByLibrary.simpleMessage("Завершить регистрацию"),
|
||||
"complite_purchase" : MessageLookupByLibrary.simpleMessage("Завершить покупку"),
|
||||
"confirm_purchase" : MessageLookupByLibrary.simpleMessage("Вы подтверждаете покупку на %s %s"),
|
||||
"confirmation" : MessageLookupByLibrary.simpleMessage("Подтверждение"),
|
||||
"no" : MessageLookupByLibrary.simpleMessage("Нет"),
|
||||
"purchase_complite" : MessageLookupByLibrary.simpleMessage("Покупка на сумму %s %s проведена"),
|
||||
"registration" : MessageLookupByLibrary.simpleMessage("Регистрация"),
|
||||
"usage" : MessageLookupByLibrary.simpleMessage("Использование"),
|
||||
"support" : MessageLookupByLibrary.simpleMessage("Контакты поддержки"),
|
||||
"common" : MessageLookupByLibrary.simpleMessage("Общая информация"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запрос на активацию приложения отправлен, дождитесь подтверждения активации администратором"),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Вознаграждение"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусов на счету"),
|
||||
"discount_rate" : MessageLookupByLibrary.simpleMessage("Процент скидки"),
|
||||
"discount_sum" : MessageLookupByLibrary.simpleMessage("Сумма скидки"),
|
||||
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Бонусов начислено"),
|
||||
"bonus_minus" : MessageLookupByLibrary.simpleMessage("Бонусов списано"),
|
||||
"bonus_hint" : MessageLookupByLibrary.simpleMessage("Сколько баллов списать?"),
|
||||
"coupons_used" : MessageLookupByLibrary.simpleMessage("Были погашены купоны"),
|
||||
"select_coupons" : MessageLookupByLibrary.simpleMessage("Выберите купоны для гашения"),
|
||||
"bonus_explanation" : MessageLookupByLibrary.simpleMessage("Если не указано сколько баллов списать, баллы будут начислены"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Сканировать"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Зарегистрироваться"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необходимо указать ID магазина"),
|
||||
"sum" : MessageLookupByLibrary.simpleMessage("Сумма"),
|
||||
"update_activ_status" : MessageLookupByLibrary.simpleMessage("Обновить статус активации"),
|
||||
"yes" : MessageLookupByLibrary.simpleMessage("Да"),
|
||||
"settings" : MessageLookupByLibrary.simpleMessage("Настройки"),
|
||||
"help" : MessageLookupByLibrary.simpleMessage("Справка"),
|
||||
"exit" : MessageLookupByLibrary.simpleMessage("Закрыть приложение"),
|
||||
"logout" : MessageLookupByLibrary.simpleMessage("Выйти из аккаунта"),
|
||||
"currency" : MessageLookupByLibrary.simpleMessage("Валюта"),
|
||||
"locale" : MessageLookupByLibrary.simpleMessage("Язык"),
|
||||
"nominative_ruble": MessageLookupByLibrary.simpleMessage("Рубль"),
|
||||
"singular_ruble": MessageLookupByLibrary.simpleMessage("Рубля"),
|
||||
"plural_ruble": MessageLookupByLibrary.simpleMessage("Рублей"),
|
||||
"nominative_dollar": MessageLookupByLibrary.simpleMessage("Доллар США"),
|
||||
"singular_dollar": MessageLookupByLibrary.simpleMessage("Доллара США"),
|
||||
"plural_dollar": MessageLookupByLibrary.simpleMessage("Долларов США"),
|
||||
"nominative_hryvna": MessageLookupByLibrary.simpleMessage("Гривна"),
|
||||
"singular_hryvna": MessageLookupByLibrary.simpleMessage("Гривны"),
|
||||
"plural_hryvna": MessageLookupByLibrary.simpleMessage("Гривен"),
|
||||
"nominative_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||
"singular_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||
"plural_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||
"nominative_euro": MessageLookupByLibrary.simpleMessage("Евро"),
|
||||
"singular_euro": MessageLookupByLibrary.simpleMessage("Евро"),
|
||||
"plural_euro": MessageLookupByLibrary.simpleMessage("Евро"),
|
||||
"registration_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
После запуска приложения вы окажетесь на странице регистрации магазина.
|
||||
|
||||
Введите ID код магазина (выдается при подключении к системе лояльности)
|
||||
|
||||
Кликните по кнопке: «Зарегистрировать»
|
||||
Дождитесь подтверждение активации программы, нажатием по кнопке «Обновите статус активации» обновите статус.
|
||||
|
||||
После подтверждения запроса на активацию программы Партнером/менеджером кликните по кнопке «Завершить регистрацию», приложение готово к использованию.
|
||||
|
||||
При желании изменить ID магазина, необходимо нажать на кнопку Меню (верхний правый угол экрана) и выбрать ""Выход"".
|
||||
'''),
|
||||
"usage_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Шаг 1:
|
||||
|
||||
Запустите приложение для сканирования карты участника системы лояльности.
|
||||
|
||||
При успешном сканировании на вашем экране появятся данные покупателя.
|
||||
|
||||
Шаг 2:
|
||||
|
||||
Введите сумму покупки данного покупателя и нажмите на кнопку «Проведение покупки».
|
||||
|
||||
Во всплывающем окне нажмите ""ДА"", для подтверждения суммы покупки
|
||||
|
||||
Если вы хотите поправить сумму, нажмите «НЕТ» и Вы вернетесь на экран покупки и сможете её скорректировать.
|
||||
'''),
|
||||
"support_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Рекомендуйте покупателям установить мобильное приложение дисконтной системы и получайте новых лояльных покупателей.
|
||||
|
||||
При некорректной работе приложения просьба сразу обратиться по телефону нашей технической поддержки.
|
||||
|
||||
Телефон:\n%s\n
|
||||
Наш сайт:\n%s
|
||||
'''),
|
||||
"common_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Для эффективного считывания штрих-кода карты участника системы лояльности необходимо камеру сканера поднести так, чтобы в неё не попадали вертикальные полосы рамки (если они есть). Они расцениваются сканером как часть штрих-кода.
|
||||
''')
|
||||
};
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a messages_ua locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
final _keepAnalysisHappy = Intl.defaultLocale;
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
get localeName => 'messages_ua';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => {
|
||||
"ID_Store" : MessageLookupByLibrary.simpleMessage("ID магазину"),
|
||||
"ID_not_found" : MessageLookupByLibrary.simpleMessage("Ідентифікатор %s не знайден"),
|
||||
"app_activ" : MessageLookupByLibrary.simpleMessage("Додаток активований"),
|
||||
"ask_change_store" : MessageLookupByLibrary.simpleMessage("Ви дійсно хочете вийти і ввести інший номер магазину"),
|
||||
"buyer" : MessageLookupByLibrary.simpleMessage("Покупець"),
|
||||
"card" : MessageLookupByLibrary.simpleMessage("Карта"),
|
||||
"card_scaner" : MessageLookupByLibrary.simpleMessage("Сканер карти"),
|
||||
"carry_purchase" : MessageLookupByLibrary.simpleMessage("Проведення покупки"),
|
||||
"complite_activ" : MessageLookupByLibrary.simpleMessage("Завершити реєстрацію"),
|
||||
"complite_purchase" : MessageLookupByLibrary.simpleMessage("Завершити купівлю"),
|
||||
"confirm_purchase" : MessageLookupByLibrary.simpleMessage("Ви підтверджуєте покупку на %s %s"),
|
||||
"confirmation" : MessageLookupByLibrary.simpleMessage("Підтвердження"),
|
||||
"no" : MessageLookupByLibrary.simpleMessage("Ні"),
|
||||
"purchase_complite" : MessageLookupByLibrary.simpleMessage("Купівля на суму %s %s проведена"),
|
||||
"registration" : MessageLookupByLibrary.simpleMessage("Реєстрація"),
|
||||
"usage" : MessageLookupByLibrary.simpleMessage("Використання"),
|
||||
"support" : MessageLookupByLibrary.simpleMessage("Контакти підтримки"),
|
||||
"common" : MessageLookupByLibrary.simpleMessage("Загальна інформація"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запит на активацію додатку відправлений, дочекайтеся підтвердження активації адміністратором"),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Винагорода"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусів на рахунку"),
|
||||
"discount_rate" : MessageLookupByLibrary.simpleMessage("Відсоток знижки"),
|
||||
"discount_sum" : MessageLookupByLibrary.simpleMessage("Сума знижки"),
|
||||
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Бонусів нараховано"),
|
||||
"bonus_minus" : MessageLookupByLibrary.simpleMessage("Бонусів списано"),
|
||||
"bonus_hint" : MessageLookupByLibrary.simpleMessage("Скільки балів списати?"),
|
||||
"coupons_used" : MessageLookupByLibrary.simpleMessage("Були погашені купони"),
|
||||
"bonus_explanation" : MessageLookupByLibrary.simpleMessage("Якщо не вказано скільки балів списати, бали будуть нараховані"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Сканувати"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Зареєструватися"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необхідно вказати ID магазину"),
|
||||
"sum" : MessageLookupByLibrary.simpleMessage("Сума"),
|
||||
"update_activ_status" : MessageLookupByLibrary.simpleMessage("Оновити статус активації"),
|
||||
"yes" : MessageLookupByLibrary.simpleMessage("Так"),
|
||||
"settings" : MessageLookupByLibrary.simpleMessage("Налаштування"),
|
||||
"help" : MessageLookupByLibrary.simpleMessage("Допомога"),
|
||||
"exit" : MessageLookupByLibrary.simpleMessage("Вихід"),
|
||||
"logout" : MessageLookupByLibrary.simpleMessage("Log Out"),
|
||||
"currency" : MessageLookupByLibrary.simpleMessage("Валюта"),
|
||||
"locale" : MessageLookupByLibrary.simpleMessage("Мова"),
|
||||
"nominative_ruble": MessageLookupByLibrary.simpleMessage("Рубль"),
|
||||
"singular_ruble": MessageLookupByLibrary.simpleMessage("Рубль"),
|
||||
"plural_ruble": MessageLookupByLibrary.simpleMessage("Рубль"),
|
||||
"nominative_dollar": MessageLookupByLibrary.simpleMessage("Доллар США"),
|
||||
"singular_dollar": MessageLookupByLibrary.simpleMessage("Доллар США"),
|
||||
"plural_dollar": MessageLookupByLibrary.simpleMessage("Доллар США"),
|
||||
"nominative_hryvna": MessageLookupByLibrary.simpleMessage("Гривня"),
|
||||
"singular_hryvna": MessageLookupByLibrary.simpleMessage("Гривня"),
|
||||
"plural_hryvna": MessageLookupByLibrary.simpleMessage("Гривня"),
|
||||
"nominative_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||
"singular_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||
"plural_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||
"nominative_euro": MessageLookupByLibrary.simpleMessage("Євро"),
|
||||
"singular_euro": MessageLookupByLibrary.simpleMessage("Євро"),
|
||||
"plural_euro": MessageLookupByLibrary.simpleMessage("Євро"),
|
||||
"registration_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Після запуску програми ви опинитеся на сторінці реєстрації магазина.
|
||||
|
||||
Введіть DIN код магазину (видається при підключенні до системи лояльності)
|
||||
|
||||
Натисніть на кнопку «Зареєструвати»
|
||||
Дочекайтеся підтвердження активації програми, натисканням на кнопку «Оновлення статус активації» поновіть статус.
|
||||
|
||||
Після підтвердження запиту на активацію програми Партнером / менеджером клікніть по кнопці «Завершити реєстрацію», додаток готове до використання.
|
||||
|
||||
При бажанні змінити номер каси, необхідно натиснути на кнопку Меню (верхній правий кут екрану) і вибрати "Вихід".
|
||||
'''),
|
||||
"usage_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Крок 1:
|
||||
|
||||
При пред'явленні покупцем картки учасника системи лояльності, запустіть цю програму.
|
||||
|
||||
На екрані з'явиться сканер штрих кодів. Відскануте штрих-код карти сканером.
|
||||
|
||||
При успішному скануванні на вашому екрані з'являться дані покупця.
|
||||
|
||||
Крок 2:
|
||||
|
||||
Необхідно ввести суму покупки даного покупця і клікнути на кнопку «Проведення покупки».
|
||||
|
||||
Спливе вікно підтвердження правильності введення суми. У разі правильного введення суми, натисніть «ТАК», сума буде проведена і винагороду буде нараховано учаснику системи лояльності.
|
||||
|
||||
Якщо сума введена з помилкою, натисніть «НІ» і Ви повернетеся на крок введення суми і зможете її скорегувати.
|
||||
'''),
|
||||
"support_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Рекомендуйте покупцям встановити мобільний додаток дисконтної системи і отримуйте нових лояльних покупців.
|
||||
|
||||
При некоректній роботі програми прохання відразу звернутися за телефоном нашої технічної підтримки.
|
||||
|
||||
Телефон:\n%s\n
|
||||
Наш сайт:\n%s
|
||||
'''),
|
||||
"common_guide": MessageLookupByLibrary.simpleMessage('''
|
||||
Для ефективного зчитування штрих-коду карти учасника системи лояльності необхідно камеру сканера піднести так, щоб в неї не потрапляли вертикальні смуги рамки. Вони розцінюються сканером як частина штрих-коду.
|
||||
''')
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:checker/db.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'common.dart';
|
||||
|
||||
@@ -14,7 +13,7 @@ getCreateTokenRequest(Map httpBody) async {
|
||||
return httpClient.post(
|
||||
await getEndpoint() + 'tokens/?_dmapptoken=' + await getToken(),
|
||||
body: httpBody,
|
||||
headers: {'Accept-Language': Intl.defaultLocale});
|
||||
headers: {'Accept-Language': StringsLocalization.localeCode});
|
||||
}
|
||||
|
||||
// Проверка статуса токена. В ответе приходит параметр active, который может быть либо true, либо false,.
|
||||
@@ -25,21 +24,21 @@ getCheckTokenStatusRequest(String token) async {
|
||||
token +
|
||||
'?_dmapptoken=' +
|
||||
await getToken(),
|
||||
headers: {'Accept-Language': Intl.defaultLocale});
|
||||
headers: {'Accept-Language': StringsLocalization.localeCode});
|
||||
}
|
||||
|
||||
// Удаление токена на сервере.
|
||||
getDeleteTokenRequest(String token) async {
|
||||
return httpClient.delete(
|
||||
await getEndpoint() + 'tokens/' + token + '?_dmapptoken=' +
|
||||
await getToken(), headers: {'Accept-Language': Intl.defaultLocale});
|
||||
await getToken(), headers: {'Accept-Language': StringsLocalization.localeCode});
|
||||
}
|
||||
|
||||
getLoyaltyRequest(String endpoint, String token) async {
|
||||
var headers = {
|
||||
'DM-Authorization': 'dmapptoken ${await getToken()}',
|
||||
'Authorization': 'dmtoken ${token}',
|
||||
'Accept-Language': Intl.defaultLocale
|
||||
'Accept-Language': StringsLocalization.localeCode
|
||||
};
|
||||
|
||||
return httpClient.get(endpoint, headers: headers);
|
||||
@@ -50,7 +49,7 @@ getPurchaseRequest(String endpoint, Map body, String token) async {
|
||||
var headers = {
|
||||
'DM-Authorization': 'dmapptoken ${await getToken()}',
|
||||
'Authorization': 'dmtoken ${token}',
|
||||
'Accept-Language': Intl.defaultLocale
|
||||
'Accept-Language': StringsLocalization.localeCode
|
||||
};
|
||||
|
||||
return httpClient.post(endpoint, body: body, headers: headers);
|
||||
@@ -61,7 +60,7 @@ getCouponsRequest(String endpoint, String token) async {
|
||||
var headers = {
|
||||
'DM-Authorization': 'dmapptoken ${await getToken()}',
|
||||
'Authorization': 'dmtoken ${token}',
|
||||
'Accept-Language': Intl.defaultLocale
|
||||
'Accept-Language': StringsLocalization.localeCode
|
||||
};
|
||||
|
||||
print(headers);
|
||||
@@ -74,7 +73,7 @@ getUserByCard(String card, String token) async {
|
||||
var headers = {
|
||||
'DM-Authorization': 'dmapptoken ${await getToken()}',
|
||||
'Authorization': 'dmtoken ${token}',
|
||||
'Accept-Language': Intl.defaultLocale
|
||||
'Accept-Language': StringsLocalization.localeCode
|
||||
};
|
||||
|
||||
|
||||
@@ -89,7 +88,7 @@ getUserByPhone(String phone, String token) async {
|
||||
var headers = {
|
||||
'DM-Authorization': 'dmapptoken ${await getToken()}',
|
||||
'Authorization': 'dmtoken ${token}',
|
||||
'Accept-Language': Intl.defaultLocale
|
||||
'Accept-Language': StringsLocalization.localeCode
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import 'package:checker/db.dart';
|
||||
import 'package:checker/network.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class FinishRegistrationScreen extends BaseScreen {
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:checker/db.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:checker/common.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class LanguagesScreen extends BaseScreen {
|
||||
|
||||
@@ -39,14 +38,13 @@ class LanguagesState extends SettingsBaseState<LanguagesScreen> {
|
||||
@override
|
||||
saveOption() async {
|
||||
await helper.saveLocale(languages[selectedItem]);
|
||||
Intl.defaultLocale = languages[selectedItem];
|
||||
await StringsLocalization.load(languages[selectedItem]);
|
||||
}
|
||||
|
||||
@override
|
||||
void getSelectedValue() {
|
||||
setState(() {
|
||||
selectedItem = getOptions().indexOf(getLocaleTitle(Intl.defaultLocale));
|
||||
selectedItem = getOptions().indexOf(getLocaleTitle(StringsLocalization.localeCode));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:checker/screens/currencies.dart';
|
||||
import 'package:checker/screens/languages.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class SettingsScreen extends BaseScreen {
|
||||
|
||||
@@ -51,7 +50,7 @@ class SettingsState extends BaseState<SettingsScreen> {
|
||||
menuItems[2].title = StringsLocalization.logout();
|
||||
menuItems[0].selectedValue = info['currency'].toString();
|
||||
menuItems[1].selectedValue =
|
||||
info['locale'] == null ? Intl.defaultLocale : info['locale'];
|
||||
info['locale'] == null ? StringsLocalization.locale() : info['locale'];
|
||||
menuItems[2].selectedValue =
|
||||
info['token'] == null ? '' : getTokenSuffix(info['token']);
|
||||
});
|
||||
|
||||
@@ -11,10 +11,7 @@ import 'package:checker/screens/finish_registration.dart';
|
||||
import 'package:checker/screens/registration.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:xml/xml.dart' as xml;
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
@override
|
||||
@@ -55,10 +52,8 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
helper.getSettings(false).then((settings) {
|
||||
if (settings == null) {
|
||||
createSettingsTable(locale);
|
||||
getTranslates(locale).then((strings) {
|
||||
// platform.invokeMethod('pushTranslates').then((locale) {
|
||||
//
|
||||
// });
|
||||
StringsLocalization.load(locale).then((locale) {
|
||||
print(locale);
|
||||
});
|
||||
} else {
|
||||
initLocale(locale, () {
|
||||
@@ -69,21 +64,6 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Map> getTranslates(String locale) async {
|
||||
String strings = await loadAsset(locale);
|
||||
var document = xml.parse(strings);
|
||||
Map results = new Map<String, String>();
|
||||
document.findAllElements('string').forEach((node) {
|
||||
print(node.name.toString() + node.text.toString());
|
||||
results[node.name.toString()] = node.text.toString();
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
Future<String> loadAsset(String locale) async {
|
||||
return await rootBundle.loadString('assets/values-$locale/strings.xml');
|
||||
}
|
||||
|
||||
void initWithSavedValue(String locale) {
|
||||
initLocale(locale, () {
|
||||
showNext();
|
||||
@@ -100,7 +80,6 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
}
|
||||
|
||||
void initLocale<T>(String locale, Future<T> onValue()) {
|
||||
Intl.defaultLocale = locale;
|
||||
StringsLocalization.load(locale).then((_) {
|
||||
onValue();
|
||||
});
|
||||
|
||||
164
lib/strings.dart
164
lib/strings.dart
@@ -1,18 +1,33 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'i18n/messages_all.dart';
|
||||
import 'package:sprintf/sprintf.dart';
|
||||
import 'dart:async';
|
||||
import 'package:sprintf/sprintf.dart';
|
||||
import 'package:xml/xml.dart' as xml;
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class StringsLocalization {
|
||||
|
||||
static String localeCode;
|
||||
static Map<String, String> strings = new Map<String, String>();
|
||||
|
||||
static Future load(String locale) async {
|
||||
return initializeMessages(locale);
|
||||
localeCode = locale;
|
||||
|
||||
var document = xml.parse(await loadStrings(locale));
|
||||
strings.clear();
|
||||
document.findAllElements('string').forEach((node) {
|
||||
strings[node.attributes[0].value] = node.text.toString();
|
||||
});
|
||||
|
||||
return strings;
|
||||
|
||||
}
|
||||
|
||||
static String declineCurrency(int num, int code) {
|
||||
static Future<String> loadStrings(String locale) async {
|
||||
return await rootBundle.loadString('assets/values-$locale/strings.xml');
|
||||
}
|
||||
|
||||
static String declineCurrency(int num, int code) {
|
||||
int residual = num % 100;
|
||||
if (residual >= 20) {
|
||||
if (residual >= 20) {
|
||||
residual %= 10;
|
||||
}
|
||||
|
||||
@@ -31,7 +46,6 @@ class StringsLocalization {
|
||||
}
|
||||
|
||||
static List<String> currencies(int code) {
|
||||
|
||||
String nominative, singular, plural;
|
||||
|
||||
switch (code) {
|
||||
@@ -62,88 +76,76 @@ class StringsLocalization {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return [nominative, singular, plural];
|
||||
}
|
||||
|
||||
|
||||
static String confirmPurchase(String val, int code) {
|
||||
String trimmedVal =val.substring(0, val.length - 3);
|
||||
return sprintf(Intl.message('confirm_purchase', name: 'confirm_purchase', locale: Intl.defaultLocale), [val, declineCurrency(int.parse(trimmedVal), code)]);
|
||||
String trimmedVal = val.substring(0, val.length - 3);
|
||||
return sprintf(strings['confirm_purchase'], [val, declineCurrency(int.parse(trimmedVal), code)]);
|
||||
}
|
||||
|
||||
static String purchaseCompleted(String val, int code) {
|
||||
String trimmedVal =val.substring(0, val.length - 3);
|
||||
return sprintf(Intl.message('purchase_complite', name: 'purchase_complite', locale: Intl.defaultLocale), [val, declineCurrency(int.parse(trimmedVal), code)]);
|
||||
String trimmedVal = val.substring(0, val.length - 3);
|
||||
return sprintf(strings['purchase_complite'], [val, declineCurrency(int.parse(trimmedVal), code)]);
|
||||
}
|
||||
|
||||
static String registration() => Intl.message('registration', name: 'registration', locale: Intl.defaultLocale);
|
||||
static String usage() => Intl.message('usage', name: 'usage', locale: Intl.defaultLocale);
|
||||
static String support() => Intl.message('support', name: 'support', locale: Intl.defaultLocale);
|
||||
static String common() => Intl.message('common', name: 'common', locale: Intl.defaultLocale);
|
||||
static String idStore() => Intl.message('ID_Store', name: 'ID_Store', locale: Intl.defaultLocale);
|
||||
static String signUp() => Intl.message('sign_up', name: 'sign_up', locale: Intl.defaultLocale);
|
||||
static String specifyDinStore() => Intl.message('specify_din_store', name: 'specify_din_store', locale: Intl.defaultLocale);
|
||||
static String confirmation() => Intl.message('confirmation', name: 'confirmation', locale: Intl.defaultLocale);
|
||||
static String askChangeStore() => Intl.message('ask_change_store', name: 'ask_change_store', locale: Intl.defaultLocale);
|
||||
static String yes() => Intl.message('yes', name: 'yes', locale: Intl.defaultLocale);
|
||||
static String no() => Intl.message('no', name: 'no', locale: Intl.defaultLocale);
|
||||
static String requestSentWaitActivation() => Intl.message('request_sent_wait_activ', name: 'request_sent_wait_activ', locale: Intl.defaultLocale);
|
||||
static String refreshActivationStatus() => Intl.message('update_activ_status', name: 'update_activ_status', locale: Intl.defaultLocale);
|
||||
static String appActivated() => Intl.message('app_activ', name: 'app_activ', locale: Intl.defaultLocale);
|
||||
static String completeRegistration() => Intl.message('complite_activ', name: 'complite_activ', locale: Intl.defaultLocale);
|
||||
static String cardScanner() => Intl.message('card_scaner', name: 'card_scaner', locale: Intl.defaultLocale);
|
||||
static String card() => Intl.message('card', name: 'card', locale: Intl.defaultLocale);
|
||||
static String reward() => Intl.message('reward', name: 'reward', locale: Intl.defaultLocale);
|
||||
static String sum() => Intl.message('sum', name: 'sum', locale: Intl.defaultLocale);
|
||||
static String bonus() => Intl.message('bonus', name: 'bonus', locale: Intl.defaultLocale);
|
||||
static String couponsUsed() => Intl.message('coupons_used', name: 'coupons_used', locale: Intl.defaultLocale);
|
||||
static String selectCoupons() => Intl.message('select_coupons', name: 'select_coupons', locale: Intl.defaultLocale);
|
||||
static String carryingPurchase() => Intl.message('carry_purchase', name: 'carry_purchase', locale: Intl.defaultLocale);
|
||||
static String completePurchase() => Intl.message('complite_purchase', name: 'complite_purchase', locale: Intl.defaultLocale);
|
||||
static String scan() => Intl.message('scan', name: 'scan', locale: Intl.defaultLocale);
|
||||
static String buyer() => Intl.message('buyer', name: 'buyer', locale: Intl.defaultLocale);
|
||||
static String bonusHint() => Intl.message('bonus_hint', name: 'bonus_hint', locale: Intl.defaultLocale);
|
||||
static String bonusExplanation() => Intl.message('bonus_explanation', name: 'bonus_explanation', locale: Intl.defaultLocale);
|
||||
static String discountRate() => Intl.message('discount_rate', name: 'discount_rate', locale: Intl.defaultLocale);
|
||||
static String discountSum() => Intl.message('discount_sum', name: 'discount_sum', locale: Intl.defaultLocale);
|
||||
static String bonusPlus() => Intl.message('bonus_plus', name: 'bonus_plus', locale: Intl.defaultLocale);
|
||||
static String bonusMinus() => Intl.message('bonus_minus', name: 'bonus_minus', locale: Intl.defaultLocale);
|
||||
static String idNotFound() => Intl.message('ID_not_found', name: 'ID_not_found', locale: Intl.defaultLocale);
|
||||
static String settings() => Intl.message('settings', name: 'settings', locale: Intl.defaultLocale);
|
||||
static String help() => Intl.message('help', name: 'help', locale: Intl.defaultLocale);
|
||||
static String exit() => Intl.message('exit', name: 'exit', locale: Intl.defaultLocale);
|
||||
static String logout() => Intl.message('logout', name: 'logout', locale: Intl.defaultLocale);
|
||||
static String currency() => Intl.message('currency', name: 'currency', locale: Intl.defaultLocale);
|
||||
static String locale() => Intl.message('locale', name: 'locale', locale: Intl.defaultLocale);
|
||||
|
||||
// Валюты
|
||||
static String nominativeRuble() => Intl.message('nominative_ruble', name: 'nominative_ruble', locale: Intl.defaultLocale);
|
||||
static String singularRuble() => Intl.message('singular_ruble', name: 'singular_ruble', locale: Intl.defaultLocale);
|
||||
static String pluralRuble() => Intl.message('plural_ruble', name: 'plural_ruble', locale: Intl.defaultLocale);
|
||||
|
||||
static String nominativeEuro() => Intl.message('nominative_euro', name: 'nominative_euro', locale: Intl.defaultLocale);
|
||||
static String singularEuro() => Intl.message('singular_euro', name: 'singular_euro', locale: Intl.defaultLocale);
|
||||
static String pluralEuro() => Intl.message('plural_euro', name: 'plural_euro', locale: Intl.defaultLocale);
|
||||
|
||||
|
||||
static String nominativeDollar() => Intl.message('nominative_dollar', name: 'nominative_dollar', locale: Intl.defaultLocale);
|
||||
static String singularDollar() => Intl.message('singular_dollar', name: 'singular_dollar', locale: Intl.defaultLocale);
|
||||
static String pluralDollar() => Intl.message('plural_dollar', name: 'plural_dollar', locale: Intl.defaultLocale);
|
||||
|
||||
static String nominativeHryvna() => Intl.message('nominative_hryvna', name: 'nominative_hryvna', locale: Intl.defaultLocale);
|
||||
static String singularHryvna() => Intl.message('singular_hryvna', name: 'singular_hryvna', locale: Intl.defaultLocale);
|
||||
static String pluralHryvna() => Intl.message('plural_hryvna', name: 'plural_hryvna', locale: Intl.defaultLocale);
|
||||
|
||||
static String nominativeTenge() => Intl.message('nominative_tenge', name: 'nominative_tenge', locale: Intl.defaultLocale);
|
||||
static String singularTenge() => Intl.message('singular_tenge', name: 'singular_tenge', locale: Intl.defaultLocale);
|
||||
static String pluralTenge() => Intl.message('plural_tenge', name: 'plural_tenge', locale: Intl.defaultLocale);
|
||||
|
||||
static String registrationGuide() => Intl.message('registration_guide', name: 'registration_guide', locale: Intl.defaultLocale);
|
||||
static String usageGuide() => Intl.message('usage_guide', name: 'usage_guide', locale: Intl.defaultLocale);
|
||||
static String commonGuide() => Intl.message('common_guide', name: 'common_guide', locale: Intl.defaultLocale);
|
||||
|
||||
static String supportGuide(String phone, String url) {
|
||||
return sprintf(Intl.message('support_guide', name: 'support_guide', locale: Intl.defaultLocale), [phone, url]);
|
||||
}
|
||||
static String registration() => strings['registration'];
|
||||
static String usage() => strings['usage'];
|
||||
static String support() => strings['support'];
|
||||
static String common() => strings['common'];
|
||||
static String idStore() => strings['ID_Store'];
|
||||
static String signUp() => strings['sign_up'];
|
||||
static String specifyDinStore() => strings['specify_din_store'];
|
||||
static String confirmation() => strings['confirmation'];
|
||||
static String askChangeStore() => strings['ask_change_store'];
|
||||
static String yes() => strings['yes'];
|
||||
static String no() => strings['no'];
|
||||
static String requestSentWaitActivation() => strings['request_sent_wait_activ'];
|
||||
static String refreshActivationStatus() => strings['update_activ_status'];
|
||||
static String appActivated() => strings['app_activ'];
|
||||
static String completeRegistration() => strings['complite_activ'];
|
||||
static String cardScanner() => strings['card_scaner'];
|
||||
static String card() => strings['card'];
|
||||
static String reward() => strings['reward'];
|
||||
static String sum() => strings['sum'];
|
||||
static String bonus() => strings['bonus'];
|
||||
static String couponsUsed() => strings['coupons_used'];
|
||||
static String selectCoupons() => strings['select_coupons'];
|
||||
static String carryingPurchase() => strings['carry_purchase'];
|
||||
static String completePurchase() => strings['complite_purchase'];
|
||||
static String scan() => strings['scan'];
|
||||
static String buyer() => strings['buyer'];
|
||||
static String bonusHint() => strings['bonus_hint'];
|
||||
static String bonusExplanation() => strings['bonus_explanation'];
|
||||
static String discountRate() => strings['discount_rate'];
|
||||
static String discountSum() => strings['discount_sum'];
|
||||
static String bonusPlus() => strings['bonus_plus'];
|
||||
static String bonusMinus() => strings['bonus_minus'];
|
||||
static String idNotFound() => strings['ID_not_found'];
|
||||
static String settings() => strings['settings'];
|
||||
static String help() => strings['help'];
|
||||
static String exit() => strings['exit'];
|
||||
static String logout() => strings['logout'];
|
||||
static String currency() => strings['currency'];
|
||||
static String locale() => strings['locale'];
|
||||
static String nominativeRuble() => strings['nominative_ruble'];
|
||||
static String singularRuble() => strings['singular_ruble'];
|
||||
static String pluralRuble() => strings['plural_ruble'];
|
||||
static String nominativeEuro() => strings['nominative_euro'];
|
||||
static String singularEuro() => strings['singular_euro'];
|
||||
static String pluralEuro() => strings['plural_euro'];
|
||||
static String nominativeDollar() => strings['nominative_dollar'];
|
||||
static String singularDollar() => strings['singular_dollar'];
|
||||
static String pluralDollar() => strings['plural_dollar'];
|
||||
static String nominativeHryvna() => strings['nominative_hryvna'];
|
||||
static String singularHryvna() => strings['singular_hryvna'];
|
||||
static String pluralHryvna() => strings['plural_hryvna'];
|
||||
static String nominativeTenge() => strings['nominative_tenge'];
|
||||
static String singularTenge() => strings['singular_tenge'];
|
||||
static String pluralTenge() => strings['plural_tenge'];
|
||||
static String registrationGuide() => strings['registration_guide'];
|
||||
static String usageGuide() => strings['usage_guide'];
|
||||
static String commonGuide() => strings['common_guide'].replaceAll('\n', "\n");
|
||||
static String supportGuide(String phone, String url) => sprintf(strings['support_guide'], [phone, url]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user