diff --git a/CHANGELOG.md b/CHANGELOG.md index d6939ae0d..dfaefa52d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Date format: DD/MM/YYYY - Improves `icons.dart` formatting and its generation. - Fix: [#207](https://github.com/bdlukaa/fluent_ui/pull/207) FilledButton disabled foreground +- NEW: Widgets translated into multiple languages: [#216](https://github.com/bdlukaa/fluent_ui/pull/216) +- Add `useInheritedMediaQuery` property to `FluentApp` [#211](https://github.com/bdlukaa/fluent_ui/pull/211) ## [3.9.1] - Input Update - [25/02/2022] diff --git a/README.md b/README.md index c318e4304..bbbf6482a 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,9 @@ Unofficial implementation of Fluent UI for [Flutter](flutter.dev). It's written - [Pill Button Bar](#pill-button-bar) - [Snackbar](#snackbar) - [Equivalents with the material library](#equivalents-with-the-material-library) +- [Localization](#Localization) - [Contribution](#contribution) + -[Contributing new localizations](#contributing-new-localizations) - [Acknowledgements](#acknowledgements) ## Motivation @@ -1681,12 +1683,40 @@ The list of equivalents between this library and `flutter/material.dart` | - | PillButtonBar | | ExpansionPanel | Expander | +## Localization + +FluentUI widgets currently supports out-of-the-box an wide number of languages, including: + +- English +- French +- German +- Hindi +- Portuguese +- Russian +- Simplified Chinese +- Spanish + ## Contribution Feel free to [file an issue](https://github.com/bdlukaa/fluent_ui/issues/new) if you find a problem or [make pull requests](https://github.com/bdlukaa/fluent_ui/pulls). All contributions are welcome :) +### Contributing new localizations + +In [PR#216](https://github.com/bdlukaa/fluent_ui/pull/216) we added support for new localizations in FluentUI Widgets. + +If you want to contribute adding new localizations please follow this steps: + +- [Fork the repo](https://github.com/bdlukaa/fluent_ui/fork) +- Copy `lib/l10n/intl_en.arb` file into `lib/l10n` folder with a new language code, following [this list of ISO 859-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) +- Update the contents in the newly created file. Specially, please update the `@locale` value with the corresponding ISO code. +- Then update the `localization.dart:defaultSupportedLocales` list, adding an entry for each new locale +- If your IDE doesn't have any of the `intl` plugins ([Intl plugin for Android Studio/IntelliJ](https://plugins.jetbrains.com/plugin/13666-flutter-intl) / [Flutter Intl for VSCode](https://marketplace.visualstudio.com/items?itemName=localizely.flutter-intl) ) please run your project and code generation will take place. +- When you're done, [make a new pull request](https://github.com/bdlukaa/fluent_ui/pulls) + +More about [Localization in the Flutter Official Documentation](https://docs.flutter.dev/development/accessibility-and-localization/internationalization) + ### Acknowledgements Irrespective of order, thanks to all the people below for contributing with the project. It means a lot to me :) diff --git a/example/pubspec.lock b/example/pubspec.lock index 41241f856..6beb628fe 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -111,6 +111,11 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.4" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" flutter_native_splash: dependency: "direct dev" description: diff --git a/lib/generated/intl/messages_all.dart b/lib/generated/intl/messages_all.dart new file mode 100644 index 000000000..64fc3039e --- /dev/null +++ b/lib/generated/intl/messages_all.dart @@ -0,0 +1,90 @@ +// 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. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:implementation_imports, file_names, unnecessary_new +// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering +// ignore_for_file:argument_type_not_assignable, invalid_assignment +// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases +// ignore_for_file:comment_references + +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_de.dart' as messages_de; +import 'messages_en.dart' as messages_en; +import 'messages_es.dart' as messages_es; +import 'messages_fr.dart' as messages_fr; +import 'messages_hi.dart' as messages_hi; +import 'messages_pt.dart' as messages_pt; +import 'messages_ru.dart' as messages_ru; +import 'messages_zh.dart' as messages_zh; + +typedef Future LibraryLoader(); +Map _deferredLibraries = { + 'de': () => new Future.value(null), + 'en': () => new Future.value(null), + 'es': () => new Future.value(null), + 'fr': () => new Future.value(null), + 'hi': () => new Future.value(null), + 'pt': () => new Future.value(null), + 'ru': () => new Future.value(null), + 'zh': () => new Future.value(null), +}; + +MessageLookupByLibrary? _findExact(String localeName) { + switch (localeName) { + case 'de': + return messages_de.messages; + case 'en': + return messages_en.messages; + case 'es': + return messages_es.messages; + case 'fr': + return messages_fr.messages; + case 'hi': + return messages_hi.messages; + case 'pt': + return messages_pt.messages; + case 'ru': + return messages_ru.messages; + case 'zh': + return messages_zh.messages; + default: + return null; + } +} + +/// User programs should call this before using [localeName] for messages. +Future initializeMessages(String localeName) async { + var availableLocale = Intl.verifiedLocale( + localeName, (locale) => _deferredLibraries[locale] != null, + onFailure: (_) => null); + if (availableLocale == null) { + return new Future.value(false); + } + var lib = _deferredLibraries[availableLocale]; + await (lib == null ? new Future.value(false) : lib()); + initializeInternalMessageLookup(() => new CompositeMessageLookup()); + messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); + return new Future.value(true); +} + +bool _messagesExistFor(String locale) { + try { + return _findExact(locale) != null; + } catch (e) { + return false; + } +} + +MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { + var actualLocale = + Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); + if (actualLocale == null) return null; + return _findExact(actualLocale); +} diff --git a/lib/generated/intl/messages_de.dart b/lib/generated/intl/messages_de.dart new file mode 100644 index 000000000..07b49e827 --- /dev/null +++ b/lib/generated/intl/messages_de.dart @@ -0,0 +1,66 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a de locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'de'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("Zurück"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("Zum Suchen klicken"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("Schließen"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Navigation schließen"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("Tab schließen"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("Schließen"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("Kopieren"), + "copyActionTooltip": MessageLookupByLibrary.simpleMessage( + "Ausgewählten Inhalt in die Zwischenablage kopieren"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("Ausschneiden"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "Ausgewählten Inhalt entfernen und in die Zwischenablage legen"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("Dialog"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("Minimieren"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("Schließen"), + "newTabLabel": + MessageLookupByLibrary.simpleMessage("Neuen Tab hinzufügen"), + "noResultsFoundLabel": + MessageLookupByLibrary.simpleMessage("Keine Ergebnisse gefunden"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Navigation öffnen"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("Einfügen"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "Fügt den Inhalt der Zwischenablage an der aktuellen Stelle ein"), + "restoreWindowTooltip": + MessageLookupByLibrary.simpleMessage("Wiederherstellen"), + "scrollTabBackwardLabel": MessageLookupByLibrary.simpleMessage( + "Tab-Liste rückwärts scrollen"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("Tabliste vorwärts scrollen"), + "searchLabel": MessageLookupByLibrary.simpleMessage("Suchen"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("Alles auswählen"), + "selectAllActionTooltip": + MessageLookupByLibrary.simpleMessage("Alle Inhalte auswählen") + }; +} diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart new file mode 100644 index 000000000..852f7793d --- /dev/null +++ b/lib/generated/intl/messages_en.dart @@ -0,0 +1,64 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a en locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'en'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("Back"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("Click to search"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("Close"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Close Navigation"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("Close tab"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("Close"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("Copy"), + "copyActionTooltip": MessageLookupByLibrary.simpleMessage( + "Copy the selected content to the clipboard"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("Cut"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "Remove the selected content and put it in the clipboard"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("Dialog"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("Minimize"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("Dismiss"), + "newTabLabel": MessageLookupByLibrary.simpleMessage("Add new tab"), + "noResultsFoundLabel": + MessageLookupByLibrary.simpleMessage("No results found"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Open Navigation"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("Paste"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "Inserts the contents of the clipboard at the current location"), + "restoreWindowTooltip": MessageLookupByLibrary.simpleMessage("Restore"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("Scroll tab list backward"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("Scroll tab list forward"), + "searchLabel": MessageLookupByLibrary.simpleMessage("Search"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("Select all"), + "selectAllActionTooltip": + MessageLookupByLibrary.simpleMessage("Select all content") + }; +} diff --git a/lib/generated/intl/messages_es.dart b/lib/generated/intl/messages_es.dart new file mode 100644 index 000000000..969e9b71f --- /dev/null +++ b/lib/generated/intl/messages_es.dart @@ -0,0 +1,66 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a es locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'es'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("Volver"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("Haz clic para buscar"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("Cerrar"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Cerrar Navegador"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("Cerrar pestaña"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("Cerrar"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("Copiar"), + "copyActionTooltip": MessageLookupByLibrary.simpleMessage( + "Copiar el contenido seleccionado al portapapeles"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("Cortar"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "Cortar el contenido seleccionado y ponerlo en el portapapeles"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("Diálogo"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("Minimizar"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("Cancelar"), + "newTabLabel": + MessageLookupByLibrary.simpleMessage("Añadir nueva pestaña"), + "noResultsFoundLabel": MessageLookupByLibrary.simpleMessage( + "No se encontraron resultados"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Abrir Navegador"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("Pegar"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "Insertar el contenido del portapapeles en la posición actual"), + "restoreWindowTooltip": + MessageLookupByLibrary.simpleMessage("Restaurar"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("Hacer scroll hacia atrás"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("Hacer scroll hacia delante"), + "searchLabel": MessageLookupByLibrary.simpleMessage("Buscar"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("Seleccionar todo"), + "selectAllActionTooltip": MessageLookupByLibrary.simpleMessage( + "Seleccionar todo el contenido") + }; +} diff --git a/lib/generated/intl/messages_fr.dart b/lib/generated/intl/messages_fr.dart new file mode 100644 index 000000000..6c507236e --- /dev/null +++ b/lib/generated/intl/messages_fr.dart @@ -0,0 +1,66 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a fr locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'fr'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("Retour"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("Cliquez pour rechercher"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("Fermer"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Fermer le navigateur"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("Fermer l\'onglet"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("Fermer"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("Copier"), + "copyActionTooltip": MessageLookupByLibrary.simpleMessage( + "Copier le contenu sélectionné dans le presse-papier"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("Couper"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "Couper le contenu sélectionné et le mettre dans le presse-papier"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("Dialogue"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("Réduire"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("Annuler"), + "newTabLabel": + MessageLookupByLibrary.simpleMessage("Ajouter un nouvel onglet"), + "noResultsFoundLabel": + MessageLookupByLibrary.simpleMessage("Aucun résultat trouvé"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Ouvrir le navigateur"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("Coller"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "Coller le contenu du presse-papier à la position actuelle"), + "restoreWindowTooltip": + MessageLookupByLibrary.simpleMessage("Restaurer"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("Défiler vers l\'arrière"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("Défiler vers l\'avant"), + "searchLabel": MessageLookupByLibrary.simpleMessage("Rechercher"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("Tout sélectionner"), + "selectAllActionTooltip": + MessageLookupByLibrary.simpleMessage("Sélectionner tout le contenu") + }; +} diff --git a/lib/generated/intl/messages_hi.dart b/lib/generated/intl/messages_hi.dart new file mode 100644 index 000000000..41a9141f4 --- /dev/null +++ b/lib/generated/intl/messages_hi.dart @@ -0,0 +1,65 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a hi locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'hi'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("वापस"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("खोजने के लिए क्लिक करें"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("बंद करें"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("नेविगेशन बंद करें"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("टैब बंद करें"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("बंद करें"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("कॉपी"), + "copyActionTooltip": MessageLookupByLibrary.simpleMessage( + "सेलेक्टेड कंटेंट क्लिपबोर्ड पर कॉपी करें"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("कट"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "सिलेक्टेड कंटेंट यहाँ से हटा कर क्लिपबोर्ड पर कॉपी करें"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("डायलॉग"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("मिनीमाइज करें"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("हटाएँ"), + "newTabLabel": MessageLookupByLibrary.simpleMessage("नया टैब ऐड करें"), + "noResultsFoundLabel": + MessageLookupByLibrary.simpleMessage("कोई रिजल्ट नहीं मिला"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("नेविगेशन खोलें"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("पेस्ट"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "क्लिपबोर्ड का कंटेंट इस लोकेशन पर पेस्ट करें"), + "restoreWindowTooltip": + MessageLookupByLibrary.simpleMessage("वापिस लाएं"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("टैब लिस्ट पीछे स्क्रॉल करें"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("टैब लिस्ट आगे स्क्रॉल करें"), + "searchLabel": MessageLookupByLibrary.simpleMessage("खोजें"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("सब-कुछ सेलेक्ट करें"), + "selectAllActionTooltip": + MessageLookupByLibrary.simpleMessage("सारा कंटेंट सेलेक्ट करें") + }; +} diff --git a/lib/generated/intl/messages_pt.dart b/lib/generated/intl/messages_pt.dart new file mode 100644 index 000000000..b47b654bc --- /dev/null +++ b/lib/generated/intl/messages_pt.dart @@ -0,0 +1,66 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a pt locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'pt'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("Voltar"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("Clique para pesquisar"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("Fechar"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Fechar navegação"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("Fechar guia"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("Fechar"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("Copiar"), + "copyActionTooltip": MessageLookupByLibrary.simpleMessage( + "Copiar conteúdo selecionado para a área de transferência"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("Cortar"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "Recortar o conteúdo selecionado e colocá-lo na área de transferência"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("Caixa de diálogo"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("Minimizar"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("Cancelar"), + "newTabLabel": + MessageLookupByLibrary.simpleMessage("Adicionar nova guia"), + "noResultsFoundLabel": + MessageLookupByLibrary.simpleMessage("Nenhum resultado encontrado"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Abrir navegação"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("Colar"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "Colar o conteúdo da área de transferência na posição atual"), + "restoreWindowTooltip": + MessageLookupByLibrary.simpleMessage("Restaurar"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("Rolar para trás"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("Rolar para frente"), + "searchLabel": MessageLookupByLibrary.simpleMessage("Pesquisar"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("Selecionar tudo"), + "selectAllActionTooltip": + MessageLookupByLibrary.simpleMessage("Selecionar tudo") + }; +} diff --git a/lib/generated/intl/messages_ru.dart b/lib/generated/intl/messages_ru.dart new file mode 100644 index 000000000..f7dede383 --- /dev/null +++ b/lib/generated/intl/messages_ru.dart @@ -0,0 +1,65 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a ru locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'ru'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("Назад"), + "clickToSearch": + MessageLookupByLibrary.simpleMessage("Нажмите для поиска"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("Закрыть"), + "closeNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Закрыть панель навигации"), + "closeTabLabelSuffix": + MessageLookupByLibrary.simpleMessage("Закрыть вкладку"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("Закрыть"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("Копировать"), + "copyActionTooltip": + MessageLookupByLibrary.simpleMessage("Скопировать в буфер обмена"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("Вырезать"), + "cutActionTooltip": MessageLookupByLibrary.simpleMessage( + "Вырезать и поместить в буфер обмена"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("Диалог"), + "minimizeWindowTooltip": + MessageLookupByLibrary.simpleMessage("Свернуть"), + "modalBarrierDismissLabel": + MessageLookupByLibrary.simpleMessage("Отмена"), + "newTabLabel": MessageLookupByLibrary.simpleMessage("Новая вкладка"), + "noResultsFoundLabel": + MessageLookupByLibrary.simpleMessage("Результаты не найдены"), + "openNavigationTooltip": + MessageLookupByLibrary.simpleMessage("Открыть панель навигации"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("Вставить"), + "pasteActionTooltip": MessageLookupByLibrary.simpleMessage( + "Вставить содержимое буфера обмена"), + "restoreWindowTooltip": + MessageLookupByLibrary.simpleMessage("Восстановить"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("Прокрутить назад"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("Прокрутить вперед"), + "searchLabel": MessageLookupByLibrary.simpleMessage("Поиск"), + "selectAllActionLabel": + MessageLookupByLibrary.simpleMessage("Выбрать все"), + "selectAllActionTooltip": + MessageLookupByLibrary.simpleMessage("Выбрать все") + }; +} diff --git a/lib/generated/intl/messages_zh.dart b/lib/generated/intl/messages_zh.dart new file mode 100644 index 000000000..935debb91 --- /dev/null +++ b/lib/generated/intl/messages_zh.dart @@ -0,0 +1,55 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a zh locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'zh'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "backButtonTooltip": MessageLookupByLibrary.simpleMessage("返回"), + "clickToSearch": MessageLookupByLibrary.simpleMessage("点击搜索"), + "closeButtonLabel": MessageLookupByLibrary.simpleMessage("关闭"), + "closeNavigationTooltip": MessageLookupByLibrary.simpleMessage("关闭导航"), + "closeTabLabelSuffix": MessageLookupByLibrary.simpleMessage("关闭标签"), + "closeWindowTooltip": MessageLookupByLibrary.simpleMessage("关闭"), + "copyActionLabel": MessageLookupByLibrary.simpleMessage("复制"), + "copyActionTooltip": + MessageLookupByLibrary.simpleMessage("将选中的内容复制到剪贴板"), + "cutActionLabel": MessageLookupByLibrary.simpleMessage("剪切"), + "cutActionTooltip": + MessageLookupByLibrary.simpleMessage("将选中的内容剪切到剪贴板"), + "dialogLabel": MessageLookupByLibrary.simpleMessage("对话"), + "minimizeWindowTooltip": MessageLookupByLibrary.simpleMessage("最小化"), + "modalBarrierDismissLabel": MessageLookupByLibrary.simpleMessage("取消"), + "newTabLabel": MessageLookupByLibrary.simpleMessage("添加新标签"), + "noResultsFoundLabel": MessageLookupByLibrary.simpleMessage("没有找到结果"), + "openNavigationTooltip": MessageLookupByLibrary.simpleMessage("打开导航"), + "pasteActionLabel": MessageLookupByLibrary.simpleMessage("粘贴"), + "pasteActionTooltip": + MessageLookupByLibrary.simpleMessage("在当前位置插入剪贴板的内容"), + "restoreWindowTooltip": MessageLookupByLibrary.simpleMessage("恢复"), + "scrollTabBackwardLabel": + MessageLookupByLibrary.simpleMessage("向后滚动标签列表"), + "scrollTabForwardLabel": + MessageLookupByLibrary.simpleMessage("向前滚动标签列表"), + "searchLabel": MessageLookupByLibrary.simpleMessage("搜索"), + "selectAllActionLabel": MessageLookupByLibrary.simpleMessage("全选"), + "selectAllActionTooltip": MessageLookupByLibrary.simpleMessage("选择所有内容") + }; +} diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart new file mode 100644 index 000000000..917306fcc --- /dev/null +++ b/lib/generated/l10n.dart @@ -0,0 +1,325 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'intl/messages_all.dart'; + +// ************************************************************************** +// Generator: Flutter Intl IDE plugin +// Made by Localizely +// ************************************************************************** + +// ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars +// ignore_for_file: join_return_with_assignment, prefer_final_in_for_each +// ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes + +class S { + S(); + + static S? _current; + + static S get current { + assert(_current != null, + 'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.'); + return _current!; + } + + static const AppLocalizationDelegate delegate = AppLocalizationDelegate(); + + static Future load(Locale locale) { + final name = (locale.countryCode?.isEmpty ?? false) + ? locale.languageCode + : locale.toString(); + final localeName = Intl.canonicalizedLocale(name); + return initializeMessages(localeName).then((_) { + Intl.defaultLocale = localeName; + final instance = S(); + S._current = instance; + + return instance; + }); + } + + static S of(BuildContext context) { + final instance = S.maybeOf(context); + assert(instance != null, + 'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?'); + return instance!; + } + + static S? maybeOf(BuildContext context) { + return Localizations.of(context, S); + } + + /// `Back` + String get backButtonTooltip { + return Intl.message( + 'Back', + name: 'backButtonTooltip', + desc: '', + args: [], + ); + } + + /// `Close` + String get closeButtonLabel { + return Intl.message( + 'Close', + name: 'closeButtonLabel', + desc: '', + args: [], + ); + } + + /// `Search` + String get searchLabel { + return Intl.message( + 'Search', + name: 'searchLabel', + desc: '', + args: [], + ); + } + + /// `Close Navigation` + String get closeNavigationTooltip { + return Intl.message( + 'Close Navigation', + name: 'closeNavigationTooltip', + desc: '', + args: [], + ); + } + + /// `Open Navigation` + String get openNavigationTooltip { + return Intl.message( + 'Open Navigation', + name: 'openNavigationTooltip', + desc: '', + args: [], + ); + } + + /// `Click to search` + String get clickToSearch { + return Intl.message( + 'Click to search', + name: 'clickToSearch', + desc: '', + args: [], + ); + } + + /// `Dismiss` + String get modalBarrierDismissLabel { + return Intl.message( + 'Dismiss', + name: 'modalBarrierDismissLabel', + desc: '', + args: [], + ); + } + + /// `Minimize` + String get minimizeWindowTooltip { + return Intl.message( + 'Minimize', + name: 'minimizeWindowTooltip', + desc: '', + args: [], + ); + } + + /// `Restore` + String get restoreWindowTooltip { + return Intl.message( + 'Restore', + name: 'restoreWindowTooltip', + desc: '', + args: [], + ); + } + + /// `Close` + String get closeWindowTooltip { + return Intl.message( + 'Close', + name: 'closeWindowTooltip', + desc: '', + args: [], + ); + } + + /// `Dialog` + String get dialogLabel { + return Intl.message( + 'Dialog', + name: 'dialogLabel', + desc: '', + args: [], + ); + } + + /// `Cut` + String get cutActionLabel { + return Intl.message( + 'Cut', + name: 'cutActionLabel', + desc: '', + args: [], + ); + } + + /// `Copy` + String get copyActionLabel { + return Intl.message( + 'Copy', + name: 'copyActionLabel', + desc: '', + args: [], + ); + } + + /// `Paste` + String get pasteActionLabel { + return Intl.message( + 'Paste', + name: 'pasteActionLabel', + desc: '', + args: [], + ); + } + + /// `Select all` + String get selectAllActionLabel { + return Intl.message( + 'Select all', + name: 'selectAllActionLabel', + desc: '', + args: [], + ); + } + + /// `Add new tab` + String get newTabLabel { + return Intl.message( + 'Add new tab', + name: 'newTabLabel', + desc: '', + args: [], + ); + } + + /// `Close tab` + String get closeTabLabelSuffix { + return Intl.message( + 'Close tab', + name: 'closeTabLabelSuffix', + desc: '', + args: [], + ); + } + + /// `Scroll tab list backward` + String get scrollTabBackwardLabel { + return Intl.message( + 'Scroll tab list backward', + name: 'scrollTabBackwardLabel', + desc: '', + args: [], + ); + } + + /// `Scroll tab list forward` + String get scrollTabForwardLabel { + return Intl.message( + 'Scroll tab list forward', + name: 'scrollTabForwardLabel', + desc: '', + args: [], + ); + } + + /// `No results found` + String get noResultsFoundLabel { + return Intl.message( + 'No results found', + name: 'noResultsFoundLabel', + desc: '', + args: [], + ); + } + + /// `Copy the selected content to the clipboard` + String get copyActionTooltip { + return Intl.message( + 'Copy the selected content to the clipboard', + name: 'copyActionTooltip', + desc: '', + args: [], + ); + } + + /// `Remove the selected content and put it in the clipboard` + String get cutActionTooltip { + return Intl.message( + 'Remove the selected content and put it in the clipboard', + name: 'cutActionTooltip', + desc: '', + args: [], + ); + } + + /// `Inserts the contents of the clipboard at the current location` + String get pasteActionTooltip { + return Intl.message( + 'Inserts the contents of the clipboard at the current location', + name: 'pasteActionTooltip', + desc: '', + args: [], + ); + } + + /// `Select all content` + String get selectAllActionTooltip { + return Intl.message( + 'Select all content', + name: 'selectAllActionTooltip', + desc: '', + args: [], + ); + } +} + +class AppLocalizationDelegate extends LocalizationsDelegate { + const AppLocalizationDelegate(); + + List get supportedLocales { + return const [ + Locale.fromSubtags(languageCode: 'en'), + Locale.fromSubtags(languageCode: 'de'), + Locale.fromSubtags(languageCode: 'es'), + Locale.fromSubtags(languageCode: 'fr'), + Locale.fromSubtags(languageCode: 'hi'), + Locale.fromSubtags(languageCode: 'pt'), + Locale.fromSubtags(languageCode: 'ru'), + Locale.fromSubtags(languageCode: 'zh'), + ]; + } + + @override + bool isSupported(Locale locale) => _isSupported(locale); + @override + Future load(Locale locale) => S.load(locale); + @override + bool shouldReload(AppLocalizationDelegate old) => false; + + bool _isSupported(Locale locale) { + for (var supportedLocale in supportedLocales) { + if (supportedLocale.languageCode == locale.languageCode) { + return true; + } + } + return false; + } +} diff --git a/lib/l10n/README.md b/lib/l10n/README.md new file mode 100644 index 000000000..c9c940a24 --- /dev/null +++ b/lib/l10n/README.md @@ -0,0 +1 @@ +Every `.arb` localization must have a corresponding entry in `localization.dart:defaultSupportedLocales` list. \ No newline at end of file diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb new file mode 100644 index 000000000..822233cd4 --- /dev/null +++ b/lib/l10n/intl_de.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "de", + "backButtonTooltip": "Zurück", + "closeButtonLabel": "Schließen", + "searchLabel": "Suchen", + "closeNavigationTooltip": "Navigation schließen", + "openNavigationTooltip": "Navigation öffnen", + "clickToSearch": "Zum Suchen klicken", + "modalBarrierDismissLabel": "Schließen", + "minimizeWindowTooltip": "Minimieren", + "restoreWindowTooltip": "Wiederherstellen", + "closeWindowTooltip": "Schließen", + "dialogLabel": "Dialog", + "cutActionLabel": "Ausschneiden", + "copyActionLabel": "Kopieren", + "pasteActionLabel": "Einfügen", + "selectAllActionLabel": "Alles auswählen", + "newTabLabel": "Neuen Tab hinzufügen", + "closeTabLabelSuffix": "Tab schließen", + "scrollTabBackwardLabel": "Tab-Liste rückwärts scrollen", + "scrollTabForwardLabel": "Tabliste vorwärts scrollen", + "noResultsFoundLabel": "Keine Ergebnisse gefunden", + "copyActionTooltip": "Ausgewählten Inhalt in die Zwischenablage kopieren", + "cutActionTooltip": "Ausgewählten Inhalt entfernen und in die Zwischenablage legen", + "pasteActionTooltip": "Fügt den Inhalt der Zwischenablage an der aktuellen Stelle ein", + "selectAllActionTooltip": "Alle Inhalte auswählen" +} \ No newline at end of file diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb new file mode 100644 index 000000000..d385aae99 --- /dev/null +++ b/lib/l10n/intl_en.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "en", + "backButtonTooltip": "Back", + "closeButtonLabel": "Close", + "searchLabel": "Search", + "closeNavigationTooltip": "Close Navigation", + "openNavigationTooltip": "Open Navigation", + "clickToSearch": "Click to search", + "modalBarrierDismissLabel": "Dismiss", + "minimizeWindowTooltip": "Minimize", + "restoreWindowTooltip": "Restore", + "closeWindowTooltip": "Close", + "dialogLabel": "Dialog", + "cutActionLabel": "Cut", + "copyActionLabel": "Copy", + "pasteActionLabel": "Paste", + "selectAllActionLabel": "Select all", + "newTabLabel": "Add new tab", + "closeTabLabelSuffix": "Close tab", + "scrollTabBackwardLabel": "Scroll tab list backward", + "scrollTabForwardLabel": "Scroll tab list forward", + "noResultsFoundLabel": "No results found", + "copyActionTooltip": "Copy the selected content to the clipboard", + "cutActionTooltip": "Remove the selected content and put it in the clipboard", + "pasteActionTooltip": "Inserts the contents of the clipboard at the current location", + "selectAllActionTooltip": "Select all content" +} diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb new file mode 100644 index 000000000..bc48ce996 --- /dev/null +++ b/lib/l10n/intl_es.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "es", + "backButtonTooltip": "Volver", + "closeButtonLabel": "Cerrar", + "searchLabel": "Buscar", + "closeNavigationTooltip": "Cerrar Navegador", + "openNavigationTooltip": "Abrir Navegador", + "clickToSearch": "Haz clic para buscar", + "modalBarrierDismissLabel": "Cancelar", + "minimizeWindowTooltip": "Minimizar", + "restoreWindowTooltip": "Restaurar", + "closeWindowTooltip": "Cerrar", + "dialogLabel": "Diálogo", + "cutActionLabel": "Cortar", + "copyActionLabel": "Copiar", + "pasteActionLabel": "Pegar", + "selectAllActionLabel": "Seleccionar todo", + "newTabLabel": "Añadir nueva pestaña", + "closeTabLabelSuffix": "Cerrar pestaña", + "scrollTabBackwardLabel": "Hacer scroll hacia atrás", + "scrollTabForwardLabel": "Hacer scroll hacia delante", + "noResultsFoundLabel": "No se encontraron resultados", + "copyActionTooltip": "Copiar el contenido seleccionado al portapapeles", + "cutActionTooltip": "Cortar el contenido seleccionado y ponerlo en el portapapeles", + "pasteActionTooltip": "Insertar el contenido del portapapeles en la posición actual", + "selectAllActionTooltip": "Seleccionar todo el contenido" +} diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb new file mode 100644 index 000000000..1ad601b68 --- /dev/null +++ b/lib/l10n/intl_fr.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "fr", + "backButtonTooltip": "Retour", + "closeButtonLabel": "Fermer", + "searchLabel": "Rechercher", + "closeNavigationTooltip": "Fermer le navigateur", + "openNavigationTooltip": "Ouvrir le navigateur", + "clickToSearch": "Cliquez pour rechercher", + "modalBarrierDismissLabel": "Annuler", + "minimizeWindowTooltip": "Réduire", + "restoreWindowTooltip": "Restaurer", + "closeWindowTooltip": "Fermer", + "dialogLabel": "Dialogue", + "cutActionLabel": "Couper", + "copyActionLabel": "Copier", + "pasteActionLabel": "Coller", + "selectAllActionLabel": "Tout sélectionner", + "newTabLabel": "Ajouter un nouvel onglet", + "closeTabLabelSuffix": "Fermer l'onglet", + "scrollTabBackwardLabel": "Défiler vers l'arrière", + "scrollTabForwardLabel": "Défiler vers l'avant", + "noResultsFoundLabel": "Aucun résultat trouvé", + "copyActionTooltip": "Copier le contenu sélectionné dans le presse-papier", + "cutActionTooltip": "Couper le contenu sélectionné et le mettre dans le presse-papier", + "pasteActionTooltip": "Coller le contenu du presse-papier à la position actuelle", + "selectAllActionTooltip": "Sélectionner tout le contenu" +} \ No newline at end of file diff --git a/lib/l10n/intl_hi.arb b/lib/l10n/intl_hi.arb new file mode 100644 index 000000000..f12cc4957 --- /dev/null +++ b/lib/l10n/intl_hi.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "hi", + "backButtonTooltip": "वापस", + "closeButtonLabel": "बंद करें", + "searchLabel": "खोजें", + "closeNavigationTooltip": "नेविगेशन बंद करें", + "openNavigationTooltip": "नेविगेशन खोलें", + "clickToSearch": "खोजने के लिए क्लिक करें", + "modalBarrierDismissLabel": "हटाएँ", + "minimizeWindowTooltip": "मिनीमाइज करें", + "restoreWindowTooltip": "वापिस लाएं", + "closeWindowTooltip": "बंद करें", + "dialogLabel": "डायलॉग", + "cutActionLabel": "कट", + "copyActionLabel": "कॉपी", + "pasteActionLabel": "पेस्ट", + "selectAllActionLabel": "सब-कुछ सेलेक्ट करें", + "newTabLabel": "नया टैब ऐड करें", + "closeTabLabelSuffix": "टैब बंद करें", + "scrollTabBackwardLabel": "टैब लिस्ट पीछे स्क्रॉल करें", + "scrollTabForwardLabel": "टैब लिस्ट आगे स्क्रॉल करें", + "noResultsFoundLabel": "कोई रिजल्ट नहीं मिला", + "copyActionTooltip": "सेलेक्टेड कंटेंट क्लिपबोर्ड पर कॉपी करें", + "cutActionTooltip": "सिलेक्टेड कंटेंट यहाँ से हटा कर क्लिपबोर्ड पर कॉपी करें", + "pasteActionTooltip": "क्लिपबोर्ड का कंटेंट इस लोकेशन पर पेस्ट करें", + "selectAllActionTooltip": "सारा कंटेंट सेलेक्ट करें" +} \ No newline at end of file diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb new file mode 100644 index 000000000..e3d7b8ac0 --- /dev/null +++ b/lib/l10n/intl_pt.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "pt", + "backButtonTooltip": "Voltar", + "closeButtonLabel": "Fechar", + "searchLabel": "Pesquisar", + "closeNavigationTooltip": "Fechar navegação", + "openNavigationTooltip": "Abrir navegação", + "clickToSearch": "Clique para pesquisar", + "modalBarrierDismissLabel": "Cancelar", + "minimizeWindowTooltip": "Minimizar", + "restoreWindowTooltip": "Restaurar", + "closeWindowTooltip": "Fechar", + "dialogLabel": "Caixa de diálogo", + "cutActionLabel": "Cortar", + "copyActionLabel": "Copiar", + "pasteActionLabel": "Colar", + "selectAllActionLabel": "Selecionar tudo", + "newTabLabel": "Adicionar nova guia", + "closeTabLabelSuffix": "Fechar guia", + "scrollTabBackwardLabel": "Rolar para trás", + "scrollTabForwardLabel": "Rolar para frente", + "noResultsFoundLabel": "Nenhum resultado encontrado", + "copyActionTooltip": "Copiar conteúdo selecionado para a área de transferência", + "cutActionTooltip": "Recortar o conteúdo selecionado e colocá-lo na área de transferência", + "pasteActionTooltip": "Colar o conteúdo da área de transferência na posição atual", + "selectAllActionTooltip": "Selecionar tudo" +} \ No newline at end of file diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb new file mode 100644 index 000000000..b8d7b8a6b --- /dev/null +++ b/lib/l10n/intl_ru.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "ru", + "backButtonTooltip": "Назад", + "closeButtonLabel": "Закрыть", + "searchLabel": "Поиск", + "closeNavigationTooltip": "Закрыть панель навигации", + "openNavigationTooltip": "Открыть панель навигации", + "clickToSearch": "Нажмите для поиска", + "modalBarrierDismissLabel": "Отмена", + "minimizeWindowTooltip": "Свернуть", + "restoreWindowTooltip": "Восстановить", + "closeWindowTooltip": "Закрыть", + "dialogLabel": "Диалог", + "cutActionLabel": "Вырезать", + "copyActionLabel": "Копировать", + "pasteActionLabel": "Вставить", + "selectAllActionLabel": "Выбрать все", + "newTabLabel": "Новая вкладка", + "closeTabLabelSuffix": "Закрыть вкладку", + "scrollTabBackwardLabel": "Прокрутить назад", + "scrollTabForwardLabel": "Прокрутить вперед", + "noResultsFoundLabel": "Результаты не найдены", + "copyActionTooltip": "Скопировать в буфер обмена", + "cutActionTooltip": "Вырезать и поместить в буфер обмена", + "pasteActionTooltip": "Вставить содержимое буфера обмена", + "selectAllActionTooltip": "Выбрать все" +} \ No newline at end of file diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb new file mode 100644 index 000000000..314988d0a --- /dev/null +++ b/lib/l10n/intl_zh.arb @@ -0,0 +1,27 @@ +{ + "@@locale": "zh", + "backButtonTooltip": "返回", + "closeButtonLabel": "关闭", + "searchLabel": "搜索", + "closeNavigationTooltip": "关闭导航", + "openNavigationTooltip": "打开导航", + "clickToSearch": "点击搜索", + "modalBarrierDismissLabel": "取消", + "minimizeWindowTooltip": "最小化", + "restoreWindowTooltip": "恢复", + "closeWindowTooltip": "关闭", + "dialogLabel": "对话", + "cutActionLabel": "剪切", + "copyActionLabel": "复制", + "pasteActionLabel": "粘贴", + "selectAllActionLabel": "全选", + "newTabLabel": "添加新标签", + "closeTabLabelSuffix": "关闭标签", + "scrollTabBackwardLabel": "向后滚动标签列表", + "scrollTabForwardLabel": "向前滚动标签列表", + "noResultsFoundLabel": "没有找到结果", + "copyActionTooltip": "将选中的内容复制到剪贴板", + "cutActionTooltip": "将选中的内容剪切到剪贴板", + "pasteActionTooltip": "在当前位置插入剪贴板的内容", + "selectAllActionTooltip": "选择所有内容" +} \ No newline at end of file diff --git a/lib/src/app.dart b/lib/src/app.dart index d3810c03a..616f01b39 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -1,5 +1,6 @@ import 'package:fluent_ui/fluent_ui.dart'; import 'package:flutter/material.dart' as m; +import 'package:flutter_localizations/flutter_localizations.dart'; /// An application that uses fluent design. /// @@ -58,7 +59,7 @@ class FluentApp extends StatefulWidget { this.localizationsDelegates, this.localeListResolutionCallback, this.localeResolutionCallback, - this.supportedLocales = const [Locale('en', 'US')], + this.supportedLocales = defaultSupportedLocales, this.showPerformanceOverlay = false, this.checkerboardRasterCacheImages = false, this.checkerboardOffscreenLayers = false, @@ -96,7 +97,7 @@ class FluentApp extends StatefulWidget { this.localizationsDelegates, this.localeListResolutionCallback, this.localeResolutionCallback, - this.supportedLocales = const [Locale('en', 'US')], + this.supportedLocales = defaultSupportedLocales, this.showPerformanceOverlay = false, this.checkerboardRasterCacheImages = false, this.checkerboardOffscreenLayers = false, @@ -372,8 +373,8 @@ class _FluentAppState extends State { yield* widget.localizationsDelegates!; } yield DefaultFluentLocalizations.delegate; - yield m.DefaultMaterialLocalizations.delegate; - yield DefaultWidgetsLocalizations.delegate; + yield GlobalMaterialLocalizations.delegate; + yield GlobalWidgetsLocalizations.delegate; } bool get _usesRouter => widget.routerDelegate != null; diff --git a/lib/src/icons.dart b/lib/src/icons.dart index e0365eb2e..4c480e60b 100644 --- a/lib/src/icons.dart +++ b/lib/src/icons.dart @@ -15494,4 +15494,4 @@ class FluentIcons { 'waitlist_confirm_mirrored': waitlist_confirm_mirrored, 'warning': warning, }; -} +} \ No newline at end of file diff --git a/lib/src/localization.dart b/lib/src/localization.dart index 4a018c818..b35a5a46c 100644 --- a/lib/src/localization.dart +++ b/lib/src/localization.dart @@ -1,13 +1,14 @@ import 'package:fluent_ui/fluent_ui.dart'; +import 'package:fluent_ui/generated/l10n.dart'; import 'package:flutter/foundation.dart'; /// Defines the localized resource values used by the fluent widgets /// /// See also: -/// * [DefaultFluentLocalizations], the default, English-only, implementation +/// * [DefaultFluentLocalizations], the default implementation /// of this interface. abstract class FluentLocalizations { - const FluentLocalizations._(); + FluentLocalizations._(); /// Label for "close" buttons and menu items. String get closeButtonLabel; @@ -118,74 +119,44 @@ abstract class FluentLocalizations { } } -/// US English strings for the fluent widgets. +// List of supported locales. This MUST be on sync with available intl_xx.arb +// files in lib/l10n folder +// +// NOTE: This should be INTO DefaultFluentLocalizations as an static member but, +// for some strange reason, doing so results in a very strange compile error. +// This has been the only way to get it working without errors. + +// I tried to replace this with S.delegate.supportedLocales, but doing this +// din't let me set the default value in FluentApp.supportedLocales +const List defaultSupportedLocales = [ + Locale('de'), + Locale('en'), + Locale('es'), + Locale('fr'), + Locale('hi'), + Locale('pt'), + Locale('ru'), + Locale('zh'), +]; + +/// Strings for the fluent widgets. /// /// See also: /// /// * [FluentApp.localizationsDelegates], which automatically includes /// * [DefaultFluentLocalizations.delegate] by default. -class DefaultFluentLocalizations implements FluentLocalizations { - const DefaultFluentLocalizations(); +class DefaultFluentLocalizations extends S implements FluentLocalizations { + final Locale locale; - @override - String get backButtonTooltip => 'Back'; - - @override - String get closeButtonLabel => 'Close'; - - @override - String get searchLabel => 'Search'; - - @override - String get closeNavigationTooltip => 'Close Navigation'; - - @override - String get openNavigationTooltip => 'Open Navigation'; - - @override - String get clickToSearch => 'Click to search'; - - @override - String get modalBarrierDismissLabel => 'Dismiss'; - - @override - String get minimizeWindowTooltip => 'Minimze'; - - @override - String get restoreWindowTooltip => 'Restore'; - - @override - String get closeWindowTooltip => 'Close'; - - @override - String get dialogLabel => 'Dialog'; - - @override - String get cutActionLabel => 'Cut'; - - @override - String get copyActionLabel => 'Copy'; - - @override - String get pasteActionLabel => 'Paste'; - - @override - String get selectAllActionLabel => 'Select all'; - - @override - String get newTabLabel => 'Add new tab'; - - @override - String get closeTabLabel => 'Close tab (Ctrl+F4)'; - - @override - String get scrollTabBackwardLabel => 'Scroll tab list backward'; + DefaultFluentLocalizations._defaultFluentLocalizations(this.locale) { + S.load(locale); + } - @override - String get scrollTabForwardLabel => 'Scroll tab list forward'; + static bool supports(Locale locale) { + return S.delegate.supportedLocales.contains(locale); + } - @override - String get noResultsFoundLabel => 'No results found'; + // Special cases - Those that include operating system dependent messages String get _ctrlCmd { if (defaultTargetPlatform == TargetPlatform.macOS) { @@ -194,6 +165,19 @@ class DefaultFluentLocalizations implements FluentLocalizations { return 'Ctrl'; } + String get _closeTabCmd { + if (defaultTargetPlatform == TargetPlatform.macOS) { + return 'W'; + } + return 'F4'; + } + + // Close tab => () + @override + String get closeTabLabel { + return '${super.closeTabLabelSuffix} ($_ctrlCmd+$_closeTabCmd)'; + } + @override String get cutShortcut => '$_ctrlCmd+X'; @@ -206,30 +190,14 @@ class DefaultFluentLocalizations implements FluentLocalizations { @override String get selectAllShortcut => '$_ctrlCmd+A'; - @override - String get copyActionTooltip => 'Copy the selected content to the clipboard'; - - @override - String get cutActionTooltip => - 'Remove the selected content and put it in the clipboard'; - - @override - String get pasteActionTooltip => - 'Inserts the contents of the clipboard at the current location'; - - @override - String get selectAllActionTooltip => 'Select all content'; - - /// Creates an object that provides US English resource values for the fluent + /// Creates an object that provides localized resource values for the fluent /// library widgets. /// - /// The [locale] parameter is ignored. - /// /// This method is typically used to create a [LocalizationsDelegate]. /// The [FluentApp] does so by default. static Future load(Locale locale) { return SynchronousFuture( - const DefaultFluentLocalizations()); + DefaultFluentLocalizations._defaultFluentLocalizations(locale)); } static const LocalizationsDelegate delegate = @@ -241,15 +209,19 @@ class _FluentLocalizationsDelegate const _FluentLocalizationsDelegate(); @override - bool isSupported(Locale locale) => locale.languageCode == 'en'; + bool isSupported(Locale locale) { + return DefaultFluentLocalizations.supports(locale); + // defaultSupportedLocales.contains(locale); + } @override - Future load(Locale locale) => - DefaultFluentLocalizations.load(locale); + Future load(Locale locale) { + return DefaultFluentLocalizations.load(locale); + } @override bool shouldReload(_FluentLocalizationsDelegate old) => false; @override - String toString() => 'DefaultFluentLocalizations.delegate(en_US)'; + String toString() => DefaultFluentLocalizations.delegate.toString(); } diff --git a/pubspec.lock b/pubspec.lock index ced5f5b93..065124b27 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,34 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "36.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.1" + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.1" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" async: dependency: transitive description: @@ -43,6 +71,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" fake_async: dependency: transitive description: @@ -50,6 +99,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -62,11 +118,37 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.4" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" intl: dependency: "direct main" description: @@ -74,6 +156,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.17.0" + intl_utils: + dependency: "direct dev" + description: + name: intl_utils + url: "https://pub.dartlang.org" + source: hosted + version: "2.6.1" lints: dependency: transitive description: @@ -102,6 +191,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" path: dependency: transitive description: @@ -109,6 +205,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "4.4.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" recase: dependency: "direct main" description: @@ -184,6 +294,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" sdks: dart: ">=2.15.0 <3.0.0" flutter: ">=2.8.0" diff --git a/pubspec.yaml b/pubspec.yaml index 4bf211190..6b2b3bbf3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,6 +10,8 @@ environment: dependencies: flutter: sdk: flutter + flutter_localizations: + sdk: flutter intl: ^0.17.0 recase: ^4.0.0 scroll_pos: ^0.3.0 @@ -18,6 +20,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^1.0.4 + intl_utils: ^2.6.1 flutter: uses-material-design: true @@ -27,3 +30,6 @@ flutter: - family: FluentIcons fonts: - asset: fonts/FluentIcons.ttf + +flutter_intl: + enabled: true # Required. Must be set to true to activate the package. Default: false \ No newline at end of file