Skip to content

Commit

Permalink
fix: Add missing translations (#1572)
Browse files Browse the repository at this point in the history
* Add missing translations

* Email content translation

* 2 hardcoded strings

* Fix categories tests not working anymore

* Add missing translation

* Update packages/smooth_app/lib/l10n/app_en.arb

* Update packages/smooth_app/lib/l10n/app_en.arb

* Update packages/smooth_app/lib/l10n/app_en.arb

* Update packages/smooth_app/lib/l10n/app_en.arb

Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
  • Loading branch information
g123k and teolemon authored May 8, 2022
1 parent b88f686 commit e8e7fb4
Show file tree
Hide file tree
Showing 13 changed files with 474 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:openfoodfacts/utils/LanguageHelper.dart';

Expand Down Expand Up @@ -99,6 +100,7 @@ class _SmoothCategoryPickerState<T extends Comparable<T>>
initialData: null,
builder:
(BuildContext context, AsyncSnapshot<SmoothCategory<T>?> snapshot) {
final AppLocalizations appLocalizations = AppLocalizations.of(context)!;
final SmoothCategory<T>? category = snapshot.data;
if (category == null) {
return Container(
Expand All @@ -107,11 +109,17 @@ class _SmoothCategoryPickerState<T extends Comparable<T>>
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
// TODO(gspencergoog): Internationalize this.
'No Category Found for ${widget.currentPath.map<String>((T item) => item.toString()).join(' > ')}',
appLocalizations.category_picker_no_category_found_message(
widget.currentPath
.map<String>((T item) => item.toString())
.join(' > '),
),
),
TextButton(
child: const Text('BACK'),
child: Text(
appLocalizations.category_picker_no_category_found_button
.toUpperCase(),
),
onPressed: () {
setState(() {
widget.onPathChanged(widget.currentPath
Expand Down
273 changes: 273 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@
},
"support_join_slack": "Ask for help in our Slack channel",
"support_via_email": "Send us an e-mail",
"support_via_email_subject": "Smoothie help",
"support_via_email_content": "Version:{version}+{buildNumber} running on {operatingSystem}({operatingSystemVersion})",
"@support_via_email_content": {
"placeholders": {
"version": {
"type": "String"
},
"buildNumber": {
"type": "String"
},
"operatingSystem": {
"type": "String"
},
"operatingSystemVersion": {
"type": "String"
}
}
},
"termsOfUse": "Terms of use",
"@termsOfUse": {},
"about_this_app": "About this app",
Expand Down Expand Up @@ -892,6 +910,261 @@
"@user_list_name_error_same": {
"description": "Validation error about the renamed name that is the same as the initial list name"
},
"category_picker_no_category_found_message": "No category found for {items}",
"@category_picker_no_category_found_message": {
"description": "Label when no category is available",
"placeholders": {
"items": {
"type": "String"
}
}
},
"category_picker_no_category_found_button": "Back",
"@category_picker_no_category_found_button": {
"description": "Button label when no category is available"
},
"dev_preferences_screen_title": "DEV Mode",
"@dev_preferences_screen_title": {
"description": "User dev preferences - Title"
},
"dev_preferences_disable_mode": "Remove dev mode",
"@dev_preferences_disable_mode": {
"description": "User dev preferences - Remove dev mode label"
},
"dev_preferences_reset_onboarding_title": "Restart onboarding",
"@dev_preferences_reset_onboarding_title": {
"description": "User dev preferences - Reset onboarding - Title"
},
"dev_preferences_reset_onboarding_subtitle": "You then have to restart Flutter to see it again.",
"@dev_preferences_reset_onboarding_subtitle": {
"description": "User dev preferences - Reset onboarding - Subtitle"
},
"dev_preferences_environment_switch_title": "Switch between openfoodfacts.org (PROD) and test env",
"@dev_preferences_environment_switch_title": {
"description": "User dev preferences - Environment (prod/test) switcher - Title"
},
"dev_preferences_environment_switch_subtitle": "Current query type is {query}",
"@dev_preferences_environment_switch_subtitle": {
"description": "User dev preferences - Environment (prod/test) switcher - Subtitle",
"placeholders": {
"query": {
"type": "String"
}
}
},
"dev_preferences_test_environment_title": "Test env parameters",
"@dev_preferences_test_environment_title": {
"description": "User dev preferences - Info about test environment - Title"
},
"dev_preferences_test_environment_subtitle": "Current base URL of test env is {url}",
"@dev_preferences_test_environment_subtitle": {
"description": "User dev preferences - Info about test environment - Value",
"placeholders": {
"url": {
"type": "String"
}
}
},
"dev_preferences_test_environment_dialog_title": "Test Env Host",
"@dev_preferences_test_environment_dialog_title": {
"description": "User dev preferences - Info about test environment - Dialog title"
},
"dev_preferences_ml_kit_title": "Use ML Kit",
"@dev_preferences_ml_kit_title": {
"description": "User dev preferences - Enable ML Kit - Title"
},
"dev_preferences_ml_kit_subtitle": "then you have to restart this app",
"@dev_preferences_ml_kit_subtitle": {
"description": "User dev preferences - Enable ML Kit - Subtitle"
},
"dev_preferences_product_additional_features_title": "Additional button on product page",
"@dev_preferences_product_additional_features_title": {
"description": "User dev preferences - Additional buttons on product page - Title"
},
"dev_preferences_edit_ingredients_title": "Edit ingredients via a knowledge panel button",
"@dev_preferences_edit_ingredients_title": {
"description": "User dev preferences - Additional buttons on product page - Subtitle"
},
"dev_preferences_export_history_title": "Export History",
"@dev_preferences_export_history_title": {
"description": "User dev preferences - Export history - Title"
},
"dev_preferences_export_history_progress_error": "exception",
"@dev_preferences_export_history_progress_error": {
"description": "User dev preferences - Export history - Item - Error"
},
"dev_preferences_export_history_progress_found": "product found",
"@dev_preferences_export_history_progress_found": {
"description": "User dev preferences - Export history - Item - Found"
},
"dev_preferences_export_history_progress_not_found": "product NOT found",
"@dev_preferences_export_history_progress_not_found": {
"description": "User dev preferences - Export history - Item - Not found"
},
"dev_preferences_export_history_dialog_title": "Export history",
"@dev_preferences_export_history_dialog_title": {
"description": "User dev preferences - Export history - Dialog title"
},
"dev_preferences_button_positive": "Ok",
"@dev_preferences_button_positive": {
"description": "User dev preferences - Positive button label"
},
"dev_preferences_button_negative": "Cancel",
"@dev_preferences_button_negative": {
"description": "User dev preferences - Negative button label"
},
"dev_preferences_import_history_title": "Import History",
"@dev_preferences_import_history_title": {
"description": "User dev preferences - Import history - Title"
},
"dev_preferences_import_history_subtitle": "Will clear history and put 3 products in there",
"@dev_preferences_import_history_subtitle": {
"description": "User dev preferences - Import history - Subtitle"
},
"dev_preferences_import_history_result_success": "Done",
"@dev_preferences_import_history_result_success": {
"description": "User dev preferences - Import history - Result successful"
},
"dev_mode_matching_mode_title": "Switch between strong and lenient matching",
"@dev_mode_matching_mode_title": {
"description": "User dev preferences - Matching mode - Title"
},
"dev_mode_matching_mode_subtitle": "Current matching level is {mode}",
"@dev_mode_matching_mode_subtitle": {
"description": "User dev preferences - Matching mode - Subtitle",
"placeholders": {
"mode": {
"type": "String"
}
}
},
"dev_mode_matching_mode_value_strong": "Strong",
"@dev_mode_matching_mode_value_strong": {
"description": "User dev preferences - Matching mode - Value - Strong"
},
"dev_mode_matching_mode_value_lenient": "Lenient",
"@dev_mode_matching_mode_value_lenient": {
"description": "User dev preferences - Matching mode - Value - Lenient"
},
"dev_mode_scan_mode_title": "Scan Mode",
"@dev_mode_scan_mode_title": {
"description": "User dev preferences - Scan mode - Title"
},
"dev_mode_scan_mode_subtitle": "Current scan mode is :\"{mode}\"",
"@dev_mode_scan_mode_subtitle": {
"description": "User dev preferences - Scan mode - Subtitle",
"placeholders": {
"mode": {
"type": "String"
}
}
},
"dev_mode_scan_mode_dialog_title": "Scan Mode",
"@dev_mode_scan_mode_dialog_title": {
"description": "User dev preferences - Scan mode - Dialog Title"
},
"dev_mode_hide_ecoscore_title": "Exclude Ecoscore",
"@dev_mode_hide_ecoscore_title": {
"description": "User dev preferences - Disable Ecoscore - Title"
},
"dev_mode_scan_camera_only": "Only camera stream, no scanning",
"@dev_mode_scan_camera_only": {
"description": "Scan mode - Camera only"
},
"dev_mode_scan_preprocess_full_image": "Camera stream and full image preprocessing, no scanning",
"@dev_mode_scan_preprocess_full_image": {
"description": "Scan mode - Preprocess full image"
},
"dev_mode_scan_preprocess_half_image": "Camera stream and half image preprocessing, no scanning",
"@dev_mode_scan_preprocess_half_image": {
"description": "Scan mode - Preprocess half image"
},
"dev_mode_scan_scan_full_image": "Full image scanning",
"@dev_mode_scan_scan_full_image": {
"description": "Scan mode - Scan full image"
},
"dev_mode_scan_scan_half_image": "Half image scanning",
"@dev_mode_scan_scan_half_image": {
"description": "Scan mode - Scan half image"
},
"product_search_no_more_results": "You've downloaded all the $totalSize products.",
"@product_search_no_more_results": {
"description": "Product search list - No more results available",
"placeholders": {
"totalSize": {
"type": "int"
}
}
},
"product_search_button_download_more": "Download {count} more products\nAlready downloaded {downloaded} out of {totalSize}.",
"@product_search_button_download_more": {
"description": "Product search list - Button to download more results",
"placeholders": {
"count": {
"type": "int"
},
"downloaded": {
"type": "int"
},
"totalSize": {
"type": "int"
}
}
},
"edit_product_action_retake_picture": "Retake photo",
"@edit_product_action_retake_picture": {
"description": "Product edition - FAB actions - retake a picture"
},
"edit_product_action_take_picture": "Take photo",
"@edit_product_action_take_picture": {
"description": "Product edition - FAB actions - take a picture"
},
"edit_product_action_confirm": "Confirm",
"@edit_product_action_confirm": {
"description": "Product edition - FAB actions - confirm"
},
"signup_page_terms_of_use_line1": "I agree to the Open Food Facts ",
"@signup_page_terms_of_use_line1": {
"description": "User consent for terms of use (line 1)"
},
"signup_page_terms_of_use_line2": "terms of use and contribution",
"@signup_page_terms_of_use_line2": {
"description": "User consent for terms of use (line 2)"
},
"enable_dev_mode_dialog_title": "Ready for the dev mode?",
"@enable_dev_mode_dialog_title": {
"description": "Dialog title to enable the developer mode"
},
"analytics_consent_image_semantic_label": "Analytics icon",
"@analytics_consent_image_semantic_label": {
"description": "Consent Analytics icon semantics label"
},
"knowledge_panel_page_loading_error": "Fatal Error: {error}",
"@knowledge_panel_page_loading_error": {
"description": "Knowledge panel page template - Error while loading future",
"placeholders": {
"error": {
"type": "Object?"
}
}
},
"preferences_page_loading_error": "Fatal Error: {error}",
"@preferences_page_loading_error": {
"description": "Preferences page - Error while loading future",
"placeholders": {
"error": {
"type": "Object?"
}
}
},
"summary_card_button_add_basic_details": "Complete basic details",
"@summary_card_button_add_basic_details": {
"description": "Summary card - Button to add details about the product"
},
"category_picker_screen_title": "Categories",
"@category_picker_screen_title": {
"description": "Categories picker screen title"
},
"basic_details": "Basic Details",
"product_name": "Product Name",
"add_basic_details_product_name_error": "Please enter the product name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class ConsentAnalytics extends StatelessWidget {
width: size.width * 0.45,
child: SvgPicture.asset(
assetName,
semanticsLabel: 'Analytics Icons',
semanticsLabel:
appLocalizations.analytics_consent_image_semantic_label,
fit: BoxFit.contain,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class _KnowledgePanelPageTemplateState
future: _initFuture,
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.hasError) {
return Text('Fatal Error: ${snapshot.error}');
final AppLocalizations appLocalizations =
AppLocalizations.of(context)!;
return Text(
appLocalizations
.knowledge_panel_page_loading_error(snapshot.error),
);
}
if (snapshot.connectionState != ConnectionState.done) {
return const Center(child: CircularProgressIndicator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ class _PreferencesPageState extends State<PreferencesPage> {
future: _initFuture,
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.hasError) {
return Text('Fatal Error: ${snapshot.error}');
final AppLocalizations appLocalizations =
AppLocalizations.of(context)!;
return Text(
appLocalizations.preferences_page_loading_error(snapshot.error),
);
}
if (snapshot.connectionState != ConnectionState.done) {
return const Center(child: CircularProgressIndicator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ class _CategoryPickerPageState extends State<CategoryPickerPage> {

@override
Widget build(BuildContext context) {
final LocalDatabase localDatabase = context.read<LocalDatabase>();
final AppLocalizations appLocalizations = AppLocalizations.of(context)!;
final LocalDatabase localDatabase = context.read<LocalDatabase>();
return Scaffold(
appBar: AppBar(
title: Text(appLocalizations.category_picker_page_appbar_text),
title: Text(
appLocalizations.category_picker_screen_title,
),
),
body: ListView.builder(
itemBuilder: (final BuildContext context, final int index) {
Expand Down
Loading

0 comments on commit e8e7fb4

Please sign in to comment.