-
Notifications
You must be signed in to change notification settings - Fork 0
Internationalization #3
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
Open
antleeon
wants to merge
4
commits into
main
Choose a base branch
from
internationalization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .idea/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| arb-dir: lib/l10n | ||
| template-arb-file: app_en.arb | ||
| output-localization-file: app_localizations.dart | ||
| nullable-getter: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "@_LOGIN_FORM": {}, | ||
| "loginFormTitle": "Sign in to account", | ||
| "loginFormEmail": "Email", | ||
| "loginFormInvalidEmail": "Enter existing email", | ||
| "loginFormPassword": "Password", | ||
| "loginFormInvalidPassword": "Password must contain minimum 6 symbols", | ||
| "loginFormSignIn": "Sign in", | ||
|
|
||
| "@_MAIL_CONFIRMATION_FORM": {}, | ||
| "mailConfirmationFormTitle": "Confirm your e-mail address", | ||
| "mailConfirmationFormCode": "Confirmation code", | ||
| "mailConfirmationFormInvalidCode": "Code must contain 6 symbols", | ||
| "mailConfirmationFormConfirm": "Confirm email", | ||
|
|
||
| "@_REGISTRATION_FORM": {}, | ||
| "registrationFormTitle": "Create new account", | ||
| "registrationFormEmail": "Email", | ||
| "registrationFormInvalidEmail": "Enter existing email address", | ||
| "registrationFormPassword": "Password", | ||
| "registrationFormInvalidPassword": "Password must contain minimum of 6 symbols", | ||
| "registrationFormConfirmPassword": "Confirm password", | ||
| "registrationFormPasswordsUnmatch": "Passwords do not match", | ||
| "registrationFormRegister": "Register", | ||
|
|
||
| "@_NEW_PACK_SCREEN": {}, | ||
| "newPackScreenTitle": "Add a new pack", | ||
| "newPackScreenSubtitle": "You can make a photo of your pack to recognise it", | ||
| "newPackScreenCamera": "Camera", | ||
| "newPackScreenGallery": "Gallery", | ||
| "newPackImageError": "Error fetching information from pack image", | ||
| "newPackName": "Name", | ||
| "newPackCountry": "Country", | ||
| "newPackScore": "SCA score", | ||
| "newPackDescriptors": "Descriptors", | ||
| "newPackDescriptor": "Descriptor", | ||
| "newPackVariety": "Variety", | ||
| "newPackMethods": "Processing methods", | ||
| "newPackMethod": "Method", | ||
| "newPackDate": "Roast date", | ||
| "newPackSend": "Send", | ||
|
|
||
| "@_RECIPES": {}, | ||
| "recipesCoffee": "Coffee", | ||
| "recipesBrewed": "Brewed", | ||
| "recipesVolume": "ml", | ||
|
|
||
| "@_AUTH_PAGE": {}, | ||
| "authPageTitle": "PickUpRecipe", | ||
| "authPageButtonRegistration": "Have an account? Sign in", | ||
| "authPageButtonVerifyEmail": "Have an account? Sign in", | ||
| "authPageButtonLogin": "Not registered? Sign up", | ||
|
|
||
| "@_BREW_PAGE": {}, | ||
| "brewPageBrewed": "Brewed on", | ||
| "brewPageRecipeFor": "Recipe for pack", | ||
| "brewPageStart": "Start brewing!", | ||
| "brewPageStop": "Stop brewing", | ||
| "brewPageDegrees": "°C", | ||
| "brewPageMass": "g", | ||
| "brewPageVolume": "ml", | ||
| "brewPageGrind": "click", | ||
|
|
||
| "@_RECIPE_PAGE": {}, | ||
| "recipePageChoose": "Choose brewing method", | ||
| "recipePageGenerate": "Generate", | ||
| "recipePageFor": "recipe for", | ||
| "recipePageChooseGenerate": "Choose brewing method to generate", | ||
|
|
||
| "@_MAIN_PAGE": {}, | ||
| "mainPageLatest": "Latest Recipes", | ||
| "mainPageActive": "Active packs", | ||
| "mainPageHome": "Main", | ||
| "mainPageAdd": "Add pack" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "@_LOGIN_FORM": {}, | ||
| "loginFormTitle": "Вход в аккаунт", | ||
| "loginFormEmail": "Email", | ||
| "loginFormInvalidEmail": "Введите существующий email", | ||
| "loginFormPassword": "Пароль", | ||
| "loginFormInvalidPassword": "Пароль должен содержать хотя бы 6 символов", | ||
| "loginFormSignIn": "Войти", | ||
|
|
||
| "@_MAIL_CONFIRMATION_FORM": {}, | ||
| "mailConfirmationFormTitle": "Подтверждение e-mail адреса", | ||
| "mailConfirmationFormCode": "Код подтверждения", | ||
| "mailConfirmationFormInvalidCode": "Код должен состоять из 6 символов", | ||
| "mailConfirmationFormConfirm": "Подтвердить email", | ||
|
|
||
| "@_REGISTRATION_FORM": {}, | ||
| "registrationFormTitle": "Создать новый аккаунт", | ||
| "registrationFormEmail": "Email", | ||
| "registrationFormInvalidEmail": "Введите существующий emai", | ||
| "registrationFormPassword": "Пароль", | ||
| "registrationFormInvalidPassword": "Пароль должен содержать хотя бы 6 символов", | ||
| "registrationFormConfirmPassword": "Повторите пароль", | ||
| "registrationFormPasswordsUnmatch": "Пароли не совпадают", | ||
| "registrationFormRegister": "Зарегистрироваться", | ||
|
|
||
| "@_NEW_PACK_SCREEN": {}, | ||
| "newPackScreenTitle": "Добавить новую пачку", | ||
| "newPackScreenSubtitle": "Вы можете добавить фото, чтобы распознать текст", | ||
| "newPackScreenCamera": "Камера", | ||
| "newPackScreenGallery": "Галерея", | ||
| "newPackImageError": "Не удалось получить информацию с изображения", | ||
| "newPackName": "Название", | ||
| "newPackCountry": "Страна", | ||
| "newPackScore": "Оценка SCA", | ||
| "newPackDescriptors": "Дескрипторы", | ||
| "newPackDescriptor": "Дескриптор", | ||
| "newPackVariety": "Сорт", | ||
| "newPackMethods": "Методы обработки", | ||
| "newPackMethod": "Метод", | ||
| "newPackDate": "Дата обжарки", | ||
| "newPackSend": "Отправить", | ||
|
|
||
| "@_RECIPES": {}, | ||
| "recipesCoffee": "Кофе", | ||
| "recipesBrewed": "Заварен", | ||
| "recipesVolume": "мл", | ||
|
|
||
| "@_AUTH_PAGE": {}, | ||
| "authPageTitle": "PickUpRecipe", | ||
| "authPageButtonRegistration": "Уже есть аккаунт? Войти", | ||
| "authPageButtonVerifyEmail": "Уже есть аккаунт? Войти", | ||
| "authPageButtonLogin": "Нет аккаунта? Зарегестрироваться", | ||
|
|
||
| "@_BREW_PAGE": {}, | ||
| "brewPageBrewed": "Был заварен", | ||
| "brewPageRecipeFor": "Рецепт для зерна", | ||
| "brewPageStart": "Начать заваривать!", | ||
| "brewPageStop": "Закончить заваривать", | ||
| "brewPageDegrees": "°C", | ||
| "brewPageMass": "г", | ||
| "brewPageVolume": "мл", | ||
| "brewPageGrind": "помол", | ||
|
|
||
| "@_RECIPE_PAGE": {}, | ||
| "recipePageChoose": "Выберите метод заваривания", | ||
| "recipePageGenerate": "Сгенерировать", | ||
| "recipePageFor": "рецепт для", | ||
| "recipePageChooseGenerate": "Выберите метод заваривания для генерации", | ||
|
|
||
| "@_MAIN_PAGE": {}, | ||
| "mainPageLatest": "Недавние рецепты", | ||
| "mainPageActive": "Текущее зерно", | ||
| "mainPageHome": "Главная", | ||
| "mainPageAdd": "Добавить пачку" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import 'package:flutter_localizations/flutter_localizations.dart'; | ||
| import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
| import 'package:flutter/widgets.dart'; | ||
|
|
||
| class S { | ||
| static const locale = Locale('ru'); | ||
|
|
||
| static const supportedLocales = [Locale('en'), Locale('ru')]; | ||
|
|
||
| static const localizationDelegates = <LocalizationsDelegate>[ | ||
| GlobalWidgetsLocalizations.delegate, | ||
| GlobalMaterialLocalizations.delegate, | ||
| GlobalCupertinoLocalizations.delegate, | ||
| AppLocalizations.delegate, | ||
| ]; | ||
|
|
||
| static AppLocalizations of(BuildContext context) => | ||
| AppLocalizations.of(context); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import 'package:pick_up_recipe/routing/app_router.dart'; | |
| import 'package:pick_up_recipe/src/features/authentication/provider/authentication_state_notifier.dart'; | ||
| import 'package:pick_up_recipe/src/themes/dark_theme.dart'; | ||
| import 'package:pick_up_recipe/src/themes/light_theme.dart'; | ||
| import 'package:pick_up_recipe/l10n/s.dart'; | ||
|
|
||
| void main() async { | ||
| WidgetsFlutterBinding.ensureInitialized(); | ||
|
|
@@ -58,6 +59,9 @@ class _MyAppState extends ConsumerState<MyApp> { | |
| routerConfig: AppRouter(ref).config(), | ||
| theme: lightTheme, | ||
| darkTheme: darkTheme, | ||
| localizationsDelegates: S.localizationDelegates, | ||
| supportedLocales: S.supportedLocales, | ||
| locale: S.locale, | ||
| ); | ||
| } | ||
| } | ||
|
|
@@ -95,14 +99,14 @@ class _RootScreenState extends State<RootScreen> { | |
| enableFeedback: false, | ||
| selectedItemColor: Theme.of(context).colorScheme.primary, | ||
| iconSize: 28, | ||
| items: const [ | ||
| items: [ | ||
| BottomNavigationBarItem( | ||
| label: 'Main', | ||
| icon: Icon(Icons.coffee), | ||
| label: S.of(context).mainPageHome, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Давай перейдем на расширение контекста, чтобы использовать context.localizations |
||
| icon: const Icon(Icons.coffee), | ||
| ), | ||
| BottomNavigationBarItem( | ||
| label: 'Add pack', | ||
| icon: Icon(Icons.add), | ||
| label: S.of(context).mainPageAdd, | ||
| icon: const Icon(Icons.add), | ||
| ), | ||
| ], | ||
| ), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Давай все-таки поменяем нейминг