From d3e9bdafbde52b0fd083d124d60771d2c649183a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 1 Jul 2021 20:26:01 +0530 Subject: [PATCH 01/35] feat(stream_chat_localizations): Initial implementation Signed-off-by: Sahil Kumar --- .../lib/src/extension.dart | 6 + .../lib/src/stream_chat.dart | 5 - .../lib/src/stream_chat_localizations.dart | 97 ++++++++ .../lib/stream_chat_flutter.dart | 1 + packages/stream_chat_localizations/.gitignore | 74 ++++++ packages/stream_chat_localizations/.metadata | 10 + .../stream_chat_localizations/CHANGELOG.md | 3 + packages/stream_chat_localizations/LICENSE | 219 ++++++++++++++++++ packages/stream_chat_localizations/README.md | 14 ++ .../lib/src/i18n/en.json | 0 .../lib/src/stream_chat_localizations.dart | 129 +++++++++++ .../lib/stream_chat_localizations.dart | 4 + .../stream_chat_localizations/pubspec.yaml | 57 +++++ .../test/stream_chat_localization_test.dart | 12 + 14 files changed, 626 insertions(+), 5 deletions(-) create mode 100644 packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart create mode 100644 packages/stream_chat_localizations/.gitignore create mode 100644 packages/stream_chat_localizations/.metadata create mode 100644 packages/stream_chat_localizations/CHANGELOG.md create mode 100644 packages/stream_chat_localizations/LICENSE create mode 100644 packages/stream_chat_localizations/README.md create mode 100644 packages/stream_chat_localizations/lib/src/i18n/en.json create mode 100644 packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart create mode 100644 packages/stream_chat_localizations/lib/stream_chat_localizations.dart create mode 100644 packages/stream_chat_localizations/pubspec.yaml create mode 100644 packages/stream_chat_localizations/test/stream_chat_localization_test.dart diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index 5161c8e8..1a80d19e 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -103,6 +103,12 @@ extension BuildContextX on BuildContext { // ignore: public_member_api_docs double get textScaleFactor => MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0; + + String translate({ + required String key, + required String defaultValue, + }) => + StreamChatLocalizations.of(this)?.translate(key) ?? defaultValue; } /// Extension on [BorderRadius] diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index 64acae98..dfffce88 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -133,11 +133,6 @@ class StreamChatState extends State { /// The current user as a stream Stream get userStream => widget.client.state.userStream; - @override - void initState() { - super.initState(); - } - @override void didChangeDependencies() { final locale = ui.window.locale; diff --git a/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart b/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart new file mode 100644 index 00000000..3ed1a9c3 --- /dev/null +++ b/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart @@ -0,0 +1,97 @@ +import 'package:flutter/widgets.dart'; + +// TODO : Fix localization instructions +// ADDING A NEW STRING +// +// If you (someone contributing to the Stream Chat Flutter) want to add a new +// string to the StreamChatLocalizations object (e.g. because you've added a new +// widget and it has a tooltip), follow these steps: +// +// 1. Add the new getter to StreamChatLocalizations below. +// +// 2. Implement a default value in DefaultMaterialLocalizations below. +// +// 3. Add a test to test/material/localizations_test.dart that verifies that +// this new value is implemented. +// +// 4. Update the flutter_localizations package. To add a new string to the +// flutter_localizations package, you must first add it to the English +// translations (lib/src/l10n/en.json), including a description. +// +// Then you need to add new entries for the string to all of the other +// language locale files by running: +// ``` +// dart dev/tools/localization/bin/gen_missing_localizations.dart +// ``` +// Which will copy the english strings into the other locales as placeholders +// until they can be translated. +// +// Finally you need to re-generate lib/src/l10n/localizations.dart by running: +// ``` +// dart dev/tools/localization/bin/gen_localizations.dart --overwrite +// ``` +// +// There is a README file with further information in the lib/src/l10n/ +// directory. +// +// 5. If you are a Google employee, you should then also follow the instructions +// at go/flutter-l10n. If you're not, don't worry about it. +// +// UPDATING AN EXISTING STRING +// +// If you (someone contributing to the Flutter framework) want to modify an +// existing string in the MaterialLocalizations objects, follow these steps: +// +// 1. Modify the default value of the relevant getter(s) in +// DefaultMaterialLocalizations below. +// +// 2. Update the flutter_localizations package. Modify the out-of-date English +// strings in lib/src/l10n/material_en.arb. +// +// You also need to re-generate lib/src/l10n/localizations.dart by running: +// ``` +// dart dev/tools/localization/bin/gen_localizations.dart --overwrite +// ``` +// +// This script may result in your updated getters being created in newer +// locales and set to the old value of the strings. This is to be expected. +// Leave them as they were generated, and they will be picked up for +// translation. +// +// There is a README file with further information in the lib/src/l10n/ +// directory. +// +// 3. If you are a Google employee, you should then also follow the instructions +// at go/flutter-l10n. If you're not, don't worry about it. + +/// Defines the localized resource values used by the StreamChatFlutter widgets. +/// +/// See also: +/// +/// * [GlobalStreamChatLocalizations], which provides material localizations +/// for many languages. +abstract class StreamChatLocalizations { + /// + String? translate(String key); + + /// The `StreamChatLocalizations` from the closest [Localizations] instance + /// that encloses the given context. + /// + /// If no [StreamChatLocalizations] are available in the given `context`, this + /// method returns null. + /// + /// This method is just a convenient shorthand for: + /// `Localizations.of(context, StreamChatLocalizations)`. + /// + /// References to the localized resources defined by this class are typically + /// written in terms of this method. For example: + /// + /// ```dart + /// tooltip: StreamChatLocalizations.of(context).backButtonTooltip, + /// ``` + static StreamChatLocalizations? of(BuildContext context) => + Localizations.of( + context, + StreamChatLocalizations, + ); +} diff --git a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart index 62bfd299..20b2396a 100644 --- a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart +++ b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart @@ -28,6 +28,7 @@ export 'src/reaction_icon.dart'; export 'src/reaction_picker.dart'; export 'src/sending_indicator.dart'; export 'src/stream_chat.dart'; +export 'src/stream_chat_localizations.dart'; export 'src/stream_chat_theme.dart'; export 'src/stream_neumorphic_button.dart'; export 'src/stream_svg_icon.dart'; diff --git a/packages/stream_chat_localizations/.gitignore b/packages/stream_chat_localizations/.gitignore new file mode 100644 index 00000000..1985397a --- /dev/null +++ b/packages/stream_chat_localizations/.gitignore @@ -0,0 +1,74 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +build/ + +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 diff --git a/packages/stream_chat_localizations/.metadata b/packages/stream_chat_localizations/.metadata new file mode 100644 index 00000000..936336f9 --- /dev/null +++ b/packages/stream_chat_localizations/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: d79295af24c3ed621c33713ecda14ad196fd9c31 + channel: stable + +project_type: package diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md new file mode 100644 index 00000000..41cc7d81 --- /dev/null +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/packages/stream_chat_localizations/LICENSE b/packages/stream_chat_localizations/LICENSE new file mode 100644 index 00000000..49088d47 --- /dev/null +++ b/packages/stream_chat_localizations/LICENSE @@ -0,0 +1,219 @@ +SOURCE CODE LICENSE AGREEMENT + +IMPORTANT - READ THIS CAREFULLY BEFORE DOWNLOADING, INSTALLING, USING OR +ELECTRONICALLY ACCESSING THIS PROPRIETARY PRODUCT. + +THIS IS A LEGAL AGREEMENT BETWEEN STREAM.IO, INC. (“STREAM.IO”) AND THE +BUSINESS ENTITY OR PERSON FOR WHOM YOU (“YOU”) ARE ACTING (“CUSTOMER”) AS THE +LICENSEE OF THE PROPRIETARY SOFTWARE INTO WHICH THIS AGREEMENT HAS BEEN +INCLUDED (THE “AGREEMENT”). YOU AGREE THAT YOU ARE THE CUSTOMER, OR YOU ARE AN +EMPLOYEE OR AGENT OF CUSTOMER AND ARE ENTERING INTO THIS AGREEMENT FOR LICENSE +OF THE SOFTWARE BY CUSTOMER FOR CUSTOMER’S BUSINESS PURPOSES AS DESCRIBED IN +AND IN ACCORDANCE WITH THIS AGREEMENT. YOU HEREBY AGREE THAT YOU ENTER INTO +THIS AGREEMENT ON BEHALF OF CUSTOMER AND THAT YOU HAVE THE AUTHORITY TO BIND +CUSTOMER TO THIS AGREEMENT. + +STREAM.IO IS WILLING TO LICENSE THE SOFTWARE TO CUSTOMER ONLY ON THE FOLLOWING +CONDITIONS: (1) YOU ARE A CURRENT CUSTOMER OF STREAM.IO; (2) YOU ARE NOT A +COMPETITOR OF STREAM.IO; AND (3) THAT YOU ACCEPT ALL THE TERMS IN THIS +AGREEMENT. BY DOWNLOADING, INSTALLING, CONFIGURING, ACCESSING OR OTHERWISE +USING THE SOFTWARE, INCLUDING ANY UPDATES, UPGRADES, OR NEWER VERSIONS, YOU +REPRESENT, WARRANT AND ACKNOWLEDGE THAT (A) CUSTOMER IS A CURRENT CUSTOMER OF +STREAM.IO; (B) CUSTOMER IS NOT A COMPETITOR OF STREAM.IO; AND THAT (C) YOU HAVE +READ THIS AGREEMENT, UNDERSTAND THIS AGREEMENT, AND THAT CUSTOMER AGREES TO BE +BOUND BY ALL THE TERMS OF THIS AGREEMENT. + +IF YOU DO NOT AGREE TO ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT, +STREAM.IO IS UNWILLING TO LICENSE THE SOFTWARE TO CUSTOMER, AND THEREFORE, DO +NOT COMPLETE THE DOWNLOAD PROCESS, ACCESS OR OTHERWISE USE THE SOFTWARE, AND +CUSTOMER SHOULD IMMEDIATELY RETURN THE SOFTWARE AND CEASE ANY USE OF THE +SOFTWARE. + +1. SOFTWARE. The Stream.io software accompanying this Agreement, may include +Source Code, Executable Object Code, associated media, printed materials and +documentation (collectively, the “Software”). The Software also includes any +updates or upgrades to or new versions of the original Software, if and when +made available to you by Stream.io. “Source Code” means computer programming +code in human readable form that is not suitable for machine execution without +the intervening steps of interpretation or compilation. “Executable Object +Code" means the computer programming code in any other form than Source Code +that is not readily perceivable by humans and suitable for machine execution +without the intervening steps of interpretation or compilation. “Site” means a +Customer location controlled by Customer. “Authorized User” means any employee +or contractor of Customer working at the Site, who has signed a written +confidentiality agreement with Customer or is otherwise bound in writing by +confidentiality and use obligations at least as restrictive as those imposed +under this Agreement. + +2. LICENSE GRANT. Subject to the terms and conditions of this Agreement, in +consideration for the representations, warranties, and covenants made by +Customer in this Agreement, Stream.io grants to Customer, during the term of +this Agreement, a personal, non-exclusive, non-transferable, non-sublicensable +license to: + +a. install and use Software Source Code on password protected computers at a Site, +restricted to Authorized Users; + +b. create derivative works, improvements (whether or not patentable), extensions +and other modifications to the Software Source Code (“Modifications”) to build +unique scalable newsfeeds, activity streams, and in-app messaging via Stream’s +application program interface (“API”); + +c. compile the Software Source Code to create Executable Object Code versions of +the Software Source Code and Modifications to build such newsfeeds, activity +streams, and in-app messaging via the API; + +d. install, execute and use such Executable Object Code versions solely for +Customer’s internal business use (including development of websites through +which data generated by Stream services will be streamed (“Apps”)); + +e. use and distribute such Executable Object Code as part of Customer’s Apps; and + +f. make electronic copies of the Software and Modifications as required for backup +or archival purposes. + +3. RESTRICTIONS. Customer is responsible for all activities that occur in +connection with the Software. Customer will not, and will not attempt to: (a) +sublicense or transfer the Software or any Source Code related to the Software +or any of Customer’s rights under this Agreement, except as otherwise provided +in this Agreement, (b) use the Software Source Code for the benefit of a third +party or to operate a service; (c) allow any third party to access or use the +Software Source Code; (d) sublicense or distribute the Software Source Code or +any Modifications in Source Code or other derivative works based on any part of +the Software Source Code; (e) use the Software in any manner that competes with +Stream.io or its business; or (e) otherwise use the Software in any manner that +exceeds the scope of use permitted in this Agreement. Customer shall use the +Software in compliance with any accompanying documentation any laws applicable +to Customer. + +4. OPEN SOURCE. Customer and its Authorized Users shall not use any software or +software components that are open source in conjunction with the Software +Source Code or any Modifications in Source Code or in any way that could +subject the Software to any open source licenses. + +5. CONTRACTORS. Under the rights granted to Customer under this Agreement, +Customer may permit its employees, contractors, and agencies of Customer to +become Authorized Users to exercise the rights to the Software granted to +Customer in accordance with this Agreement solely on behalf of Customer to +provide services to Customer; provided that Customer shall be liable for the +acts and omissions of all Authorized Users to the extent any of such acts or +omissions, if performed by Customer, would constitute a breach of, or otherwise +give rise to liability to Customer under, this Agreement. Customer shall not +and shall not permit any Authorized User to use the Software except as +expressly permitted in this Agreement. + +6. COMPETITIVE PRODUCT DEVELOPMENT. Customer shall not use the Software in any way +to engage in the development of products or services which could be reasonably +construed to provide a complete or partial functional or commercial alternative +to Stream.io’s products or services (a “Competitive Product”). Customer shall +ensure that there is no direct or indirect use of, or sharing of, Software +source code, or other information based upon or derived from the Software to +develop such products or services. Without derogating from the generality of +the foregoing, development of Competitive Products shall include having direct +or indirect access to, supervising, consulting or assisting in the development +of, or producing any specifications, documentation, object code or source code +for, all or part of a Competitive Product. + +7. LIMITATION ON MODIFICATIONS. Notwithstanding any provision in this Agreement, +Modifications may only be created and used by Customer as permitted by this +Agreement and Modification Source Code may not be distributed to third parties. +Customer will not assert against Stream.io, its affiliates, or their customers, +direct or indirect, agents and contractors, in any way, any patent rights that +Customer may obtain relating to any Modifications for Stream.io, its +affiliates’, or their customers’, direct or indirect, agents’ and contractors’ +manufacture, use, import, offer for sale or sale of any Stream.io products or +services. + +8. DELIVERY AND ACCEPTANCE. The Software will be delivered electronically pursuant +to Stream.io standard download procedures. The Software is deemed accepted upon +delivery. + +9. IMPLEMENTATION AND SUPPORT. Stream.io has no obligation under this Agreement to +provide any support or consultation concerning the Software. + +10. TERM AND TERMINATION. The term of this Agreement begins when the Software is +downloaded or accessed and shall continue until terminated. Either party may +terminate this Agreement upon written notice. This Agreement shall +automatically terminate if Customer is or becomes a competitor of Stream.io or +makes or sells any Competitive Products. Upon termination of this Agreement for +any reason, (a) all rights granted to Customer in this Agreement immediately +cease to exist, (b) Customer must promptly discontinue all use of the Software +and return to Stream.io or destroy all copies of the Software in Customer’s +possession or control. Any continued use of the Software by Customer or attempt +by Customer to exercise any rights under this Agreement after this Agreement +has terminated shall be considered copyright infringement and subject Customer +to applicable remedies for copyright infringement. Sections 2, 5, 6, 8 and 9 +shall survive expiration or termination of this Agreement for any reason. + +11. OWNERSHIP. As between the parties, the Software and all worldwide intellectual +property rights and proprietary rights relating thereto or embodied therein, +are the exclusive property of Stream.io and its suppliers. Stream.io and its +suppliers reserve all rights in and to the Software not expressly granted to +Customer in this Agreement, and no other licenses or rights are granted by +implication, estoppel or otherwise. + +12. WARRANTY DISCLAIMER. USE OF THIS SOFTWARE IS ENTIRELY AT YOURS AND CUSTOMER’S +OWN RISK. THE SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF ANY KIND +WHATSOEVER. STREAM.IO DOES NOT MAKE, AND HEREBY DISCLAIMS, ANY WARRANTY OF ANY +KIND, WHETHER EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING WITHOUT +LIMITATION, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, TITLE, NON-INFRINGEMENT OF THIRD-PARTY RIGHTS, RESULTS, EFFORTS, +QUALITY OR QUIET ENJOYMENT. STREAM.IO DOES NOT WARRANT THAT THE SOFTWARE IS +ERROR-FREE, WILL FUNCTION WITHOUT INTERRUPTION, WILL MEET ANY SPECIFIC NEED +THAT CUSTOMER HAS, THAT ALL DEFECTS WILL BE CORRECTED OR THAT IT IS +SUFFICIENTLY DOCUMENTED TO BE USABLE BY CUSTOMER. TO THE EXTENT THAT STREAM.IO +MAY NOT DISCLAIM ANY WARRANTY AS A MATTER OF APPLICABLE LAW, THE SCOPE AND +DURATION OF SUCH WARRANTY WILL BE THE MINIMUM PERMITTED UNDER SUCH LAW. +CUSTOMER ACKNOWLEDGES THAT IT HAS RELIED ON NO WARRANTIES OTHER THAN THE +EXPRESS WARRANTIES IN THIS AGREEMENT. + +13. LIMITATION OF LIABILITY. TO THE FULLEST EXTENT PERMISSIBLE BY LAW, STREAM.IO’S +TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR RELATED TO THE SOFTWARE OR +THIS AGREEMENT, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, +SHALL NOT EXCEED $100. IN NO EVENT WILL STREAM.IO BE LIABLE FOR ANY INDIRECT, +CONSEQUENTIAL, EXEMPLARY, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES OF ANY KIND +WHATSOEVER, INCLUDING ANY LOST DATA AND LOST PROFITS, ARISING FROM OR RELATING +TO THE SOFTWARE EVEN IF STREAM.IO HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. CUSTOMER ACKNOWLEDGES THAT THIS PROVISION REFLECTS THE AGREED UPON +ALLOCATION OF RISK FOR THIS AGREEMENT AND THAT STREAM.IO WOULD NOT ENTER INTO +THIS AGREEMENT WITHOUT THESE LIMITATIONS ON ITS LIABILITY. + +14. General. Customer may not assign or transfer this Agreement, by operation of +law or otherwise, or any of its rights under this Agreement (including the +license rights granted to Customer) to any third party without Stream.io’s +prior written consent, which consent will not be unreasonably withheld or +delayed. Stream.io may assign this Agreement, without consent, including, but +limited to, affiliate or any successor to all or substantially all its business +or assets to which this Agreement relates, whether by merger, sale of assets, +sale of stock, reorganization or otherwise. Any attempted assignment or +transfer in violation of the foregoing will be null and void. Stream.io shall +not be liable hereunder by reason of any failure or delay in the performance of +its obligations hereunder for any cause which is beyond the reasonable control. +All notices, consents, and approvals under this Agreement must be delivered in +writing by courier, by electronic mail, or by certified or registered mail, +(postage prepaid and return receipt requested) to the other party at the +address set forth in the customer agreement between Stream.io and Customer and +will be effective upon receipt or when delivery is refused. This Agreement will +be governed by and interpreted in accordance with the laws of the State of +Colorado, without reference to its choice of laws rules. The United Nations +Convention on Contracts for the International Sale of Goods does not apply to +this Agreement. Any action or proceeding arising from or relating to this +Agreement shall be brought in a federal or state court in Denver, Colorado, and +each party irrevocably submits to the jurisdiction and venue of any such court +in any such action or proceeding. All waivers must be in writing. Any waiver or +failure to enforce any provision of this Agreement on one occasion will not be +deemed a waiver of any other provision or of such provision on any other +occasion. If any provision of this Agreement is unenforceable, such provision +will be changed and interpreted to accomplish the objectives of such provision +to the greatest extent possible under applicable law and the remaining +provisions will continue in full force and effect. Customer shall not violate +any applicable law, rule or regulation, including those regarding the export of +technical data. The headings of Sections of this Agreement are for convenience +and are not to be used in interpreting this Agreement. As used in this +Agreement, the word “including” means “including but not limited to.” This +Agreement (including all exhibits and attachments) constitutes the entire +agreement between the parties regarding the subject hereof and supersedes all +prior or contemporaneous agreements, understandings and communication, whether +written or oral. This Agreement may be amended only by a written document +signed by both parties. The terms of any purchase order or similar document +submitted by Customer to Stream.io will have no effect. diff --git a/packages/stream_chat_localizations/README.md b/packages/stream_chat_localizations/README.md new file mode 100644 index 00000000..3ec4d86e --- /dev/null +++ b/packages/stream_chat_localizations/README.md @@ -0,0 +1,14 @@ +# stream_chat_localizations + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Dart +[package](https://flutter.dev/developing-packages/), +a library module containing code that can be shared easily across +multiple Flutter or Dart projects. + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/packages/stream_chat_localizations/lib/src/i18n/en.json b/packages/stream_chat_localizations/lib/src/i18n/en.json new file mode 100644 index 00000000..e69de29b diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart new file mode 100644 index 00000000..25ca28ea --- /dev/null +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -0,0 +1,129 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart' show rootBundle; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart' + show StreamChatLocalizations; + +const kStreamChatSupportedLanguages = []; + +/// Implementation of localized strings for the stream chat widgets +/// +/// ## Supported languages +/// +/// This class supports locales with the following [Locale.languageCode]s: +/// +/// {@macro flutter.localizations.material.languages} +/// +/// This list is available programmatically via [kStreamChatSupportedLanguages]. +/// +/// ## Sample code +/// +/// To include the localizations provided by this class in a [MaterialApp], +/// add [GlobalStreamChatLocalizations.delegates] to +/// [MaterialApp.localizationsDelegates], and specify the locales your +/// app supports with [MaterialApp.supportedLocales]: +/// +/// ```dart +/// new MaterialApp( +/// localizationsDelegates: GlobalStreamChatLocalizations.delegates, +/// supportedLocales: [ +/// const Locale('en', 'US'), // American English +/// const Locale('he', 'IL'), // Israeli Hebrew +/// // ... +/// ], +/// // ... +/// ) +/// ``` +/// +class GlobalStreamChatLocalizations implements StreamChatLocalizations { + /// Construct an object that defines the localized values for the widgets + /// library for US English (only). + /// + /// [LocalizationsDelegate] implementations typically call the static [load] + const GlobalStreamChatLocalizations(this.locale, this.translations); + + final Locale locale; + + final Map translations; + + static String getLocalePath(Locale locale) => + 'packages/stream_chat_localizations/i18n/${locale.languageCode}.json'; + + /// Creates an object that provides US English resource values for the + /// lowest levels of the widgets library. + /// + /// The [locale] parameter is ignored. + /// + /// This method is typically used to create a [LocalizationsDelegate]. + /// The [WidgetsApp] does so by default. + static Future load(Locale locale) async { + final localePath = getLocalePath(locale); + final rawTranslations = await rootBundle.loadString(localePath); + Map translations = json.decode(rawTranslations); + translations = translations.map( + (key, value) => MapEntry(key, value?.toString()), + ); + return GlobalStreamChatLocalizations(locale, translations); + } + + /// A [LocalizationsDelegate] for [StreamChatLocalizations]. + /// + /// Most internationalized apps will use [GlobalStreamChatLocalizations.delegates] + /// as the value of [MaterialApp.localizationsDelegates] to include + /// the localizations for both the flutter and stream chat widget libraries. + static const LocalizationsDelegate delegate = + _StreamChatLocalizationsDelegate(); + + /// A value for [MaterialApp.localizationsDelegates] that's typically used by + /// internationalized apps. + /// + /// ## Sample code + /// + /// To include the localizations provided by this class and by + /// [GlobalWidgetsLocalizations] in a [MaterialApp], + /// use [GlobalStreamChatLocalizations.delegates] as the value of + /// [MaterialApp.localizationsDelegates], and specify the locales your + /// app supports with [MaterialApp.supportedLocales]: + /// + /// ```dart + /// new MaterialApp( + /// localizationsDelegates: GlobalStreamChatLocalizations.delegates, + /// supportedLocales: [ + /// const Locale('en', 'US'), // English + /// const Locale('he', 'IL'), // Hebrew + /// ], + /// // ... + /// ) + /// ``` + static const List delegates = [ + delegate, + GlobalCupertinoLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; + + @override + String? translate(String key) => translations[key]; +} + +class _StreamChatLocalizationsDelegate + extends LocalizationsDelegate { + const _StreamChatLocalizationsDelegate(); + + @override + bool isSupported(Locale locale) => + kStreamChatSupportedLanguages.contains(locale.languageCode); + + @override + Future load(Locale locale) => + GlobalStreamChatLocalizations.load(locale); + + @override + bool shouldReload(_StreamChatLocalizationsDelegate old) => false; + + @override + String toString() => 'StreamChatLocalizations.delegate(' + '${kStreamChatSupportedLanguages.length} locales)'; +} diff --git a/packages/stream_chat_localizations/lib/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/stream_chat_localizations.dart new file mode 100644 index 00000000..9c1146d8 --- /dev/null +++ b/packages/stream_chat_localizations/lib/stream_chat_localizations.dart @@ -0,0 +1,4 @@ +/// Localizations for the StreamChat Flutter library. +library stream_chat_localization; + +export 'src/stream_chat_localizations.dart'; diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml new file mode 100644 index 00000000..34986658 --- /dev/null +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -0,0 +1,57 @@ +name: stream_chat_localizations +description: A new Flutter project. +version: 0.0.1 +homepage: + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + stream_chat_flutter: + path: ../stream_chat_flutter + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/stream_chat_localizations/test/stream_chat_localization_test.dart b/packages/stream_chat_localizations/test/stream_chat_localization_test.dart new file mode 100644 index 00000000..9ea48cb5 --- /dev/null +++ b/packages/stream_chat_localizations/test/stream_chat_localization_test.dart @@ -0,0 +1,12 @@ +import 'package:flutter_test/flutter_test.dart'; + +import 'package:stream_chat_localization/stream_chat_localizations.dart'; + +void main() { + test('adds one to input values', () { + final calculator = Calculator(); + expect(calculator.addOne(2), 3); + expect(calculator.addOne(-7), -6); + expect(calculator.addOne(0), 1); + }); +} From 26912431028dfc97d55b8941d25572b44103f36b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 8 Jul 2021 16:43:24 +0530 Subject: [PATCH 02/35] Remove json translations approach, add example for adding language Signed-off-by: Sahil Kumar --- .../stream_chat_flutter/example/lib/main.dart | 46 +++++++- .../stream_chat_flutter/example/pubspec.yaml | 2 + .../lib/src/extension.dart | 6 +- .../lib/src/message_text.dart | 3 + .../lib/src/stream_chat_localizations.dart | 5 +- packages/stream_chat_flutter/pubspec.yaml | 1 + .../lib/src/i18n/en.json | 0 .../lib/src/stream_chat_localizations.dart | 103 +++++++++++------- .../lib/src/stream_chat_localizations_en.dart | 11 ++ .../lib/stream_chat_localizations.dart | 7 +- .../stream_chat_localizations/pubspec.yaml | 37 ------- .../test/stream_chat_localization_test.dart | 22 ++-- 12 files changed, 144 insertions(+), 99 deletions(-) delete mode 100644 packages/stream_chat_localizations/lib/src/i18n/en.json create mode 100644 packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index d3522886..c1246a31 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -1,10 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -import 'package:stream_chat_persistence/stream_chat_persistence.dart'; +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; -final chatPersistentClient = StreamChatPersistenceClient( - logLevel: Level.INFO, -); +/// A custom set of localizations for the 'hi' locale. +class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { + const StreamChatLocalizationsHi() : super(localeName: 'hi'); + + static const LocalizationsDelegate delegate = + _HindiStreamChatLocalizationsDelegate(); + + @override + String get launchUrlError => 'URL लॉन्च नहीं कर सकता'; +} + +class _HindiStreamChatLocalizationsDelegate + extends LocalizationsDelegate { + const _HindiStreamChatLocalizationsDelegate(); + + @override + bool isSupported(Locale locale) => locale.languageCode == 'hi'; + + @override + Future load(Locale locale) => + SynchronousFuture(const StreamChatLocalizationsHi()); + + @override + bool shouldReload(_HindiStreamChatLocalizationsDelegate old) => false; +} void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -14,7 +39,7 @@ void main() async { final client = StreamChatClient( 's2dxdhpxd94g', logLevel: Level.INFO, - )..chatPersistenceClient = chatPersistentClient; + ); /// Set the current user and connect the websocket. In a production scenario, this should be done using /// a backend to generate a user token using our server SDK. @@ -58,6 +83,17 @@ class MyApp extends StatelessWidget { theme: ThemeData.light(), darkTheme: ThemeData.dark(), themeMode: ThemeMode.system, + supportedLocales: [ + Locale('en', 'US'), + Locale('hi', 'IN'), + ], + localizationsDelegates: [ + GlobalStreamChatLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + StreamChatLocalizationsHi.delegate, + ], builder: (context, widget) { return StreamChat( client: client, diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 408bf9e1..4eb99d86 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -29,6 +29,8 @@ dependencies: # path: ../../stream_chat_flutter_core stream_chat_flutter: path: ../ + stream_chat_localizations: + path: ../../stream_chat_localizations stream_chat_persistence: path: ../../stream_chat_persistence diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index 1a80d19e..3a495ca5 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -104,11 +104,7 @@ extension BuildContextX on BuildContext { double get textScaleFactor => MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0; - String translate({ - required String key, - required String defaultValue, - }) => - StreamChatLocalizations.of(this)?.translate(key) ?? defaultValue; + StreamChatLocalizations? get translations => StreamChatLocalizations.of(this); } /// Extension on [BorderRadius] diff --git a/packages/stream_chat_flutter/lib/src/message_text.dart b/packages/stream_chat_flutter/lib/src/message_text.dart index 6d006085..b0bd13ca 100644 --- a/packages/stream_chat_flutter/lib/src/message_text.dart +++ b/packages/stream_chat_flutter/lib/src/message_text.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Text widget to display in message class MessageText extends StatelessWidget { @@ -29,6 +30,8 @@ class MessageText extends StatelessWidget { @override Widget build(BuildContext context) { + final texts = context.translations?.launchUrlError ?? 'defaultValue'; + return Text(texts); final text = _replaceMentions(message.text ?? '').replaceAll('\n', '\n\n'); final themeData = Theme.of(context); diff --git a/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart b/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart index 3ed1a9c3..b1d81fde 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart @@ -71,9 +71,6 @@ import 'package:flutter/widgets.dart'; /// * [GlobalStreamChatLocalizations], which provides material localizations /// for many languages. abstract class StreamChatLocalizations { - /// - String? translate(String key); - /// The `StreamChatLocalizations` from the closest [Localizations] instance /// that encloses the given context. /// @@ -94,4 +91,6 @@ abstract class StreamChatLocalizations { context, StreamChatLocalizations, ); + + String get launchUrlError; } diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 342914d4..e15f51c7 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -7,6 +7,7 @@ issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: sdk: '>=2.12.0 <3.0.0' + flutter: ">=1.17.0" dependencies: cached_network_image: ^3.0.0 diff --git a/packages/stream_chat_localizations/lib/src/i18n/en.json b/packages/stream_chat_localizations/lib/src/i18n/en.json deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index 25ca28ea..b0ca6cd5 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -1,12 +1,45 @@ -import 'dart:convert'; - +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart' show rootBundle; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart' show StreamChatLocalizations; -const kStreamChatSupportedLanguages = []; +part 'stream_chat_localizations_en.dart'; + +/// The set of supported languages, as language code strings. +/// +/// The [GlobalStreamChatLocalizations.delegate] can generate localizations for +/// any [Locale] with a language code from this set. +/// +/// See also: +/// +/// * [getStreamChatTranslation], whose documentation describes these values. +const kStreamChatSupportedLanguages = {'en'}; + +/// Creates a [GlobalStreamChatLocalizations] instance for the given `locale`. +/// +/// All of the function's arguments except `locale` will be passed to the +/// [GlobalStreamChatLocalizations] constructor. (The `localeName` argument of that +/// constructor is specified by the actual subclass constructor by this +/// function.) +/// +/// The following locales are supported by this package: +/// +/// * `en` - English +/// +/// Generally speaking, this method is only intended to be used by +/// [GlobalStreamChatLocalizations.delegate]. +GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) { + switch (locale.languageCode) { + case 'en': + return const StreamChatLocalizationsEn(); + } + assert( + false, + 'getStreamChatTranslation() called for unsupported locale "$locale"', + ); + return null; +} /// Implementation of localized strings for the stream chat widgets /// @@ -30,43 +63,21 @@ const kStreamChatSupportedLanguages = []; /// localizationsDelegates: GlobalStreamChatLocalizations.delegates, /// supportedLocales: [ /// const Locale('en', 'US'), // American English -/// const Locale('he', 'IL'), // Israeli Hebrew /// // ... /// ], /// // ... /// ) /// ``` /// -class GlobalStreamChatLocalizations implements StreamChatLocalizations { - /// Construct an object that defines the localized values for the widgets - /// library for US English (only). - /// - /// [LocalizationsDelegate] implementations typically call the static [load] - const GlobalStreamChatLocalizations(this.locale, this.translations); +abstract class GlobalStreamChatLocalizations + implements StreamChatLocalizations { + /// Initializes an object that defines the StreamChat widget's localized + /// strings for the given `localeName`. + const GlobalStreamChatLocalizations({ + required String localeName, + }) : _localeName = localeName; - final Locale locale; - - final Map translations; - - static String getLocalePath(Locale locale) => - 'packages/stream_chat_localizations/i18n/${locale.languageCode}.json'; - - /// Creates an object that provides US English resource values for the - /// lowest levels of the widgets library. - /// - /// The [locale] parameter is ignored. - /// - /// This method is typically used to create a [LocalizationsDelegate]. - /// The [WidgetsApp] does so by default. - static Future load(Locale locale) async { - final localePath = getLocalePath(locale); - final rawTranslations = await rootBundle.loadString(localePath); - Map translations = json.decode(rawTranslations); - translations = translations.map( - (key, value) => MapEntry(key, value?.toString()), - ); - return GlobalStreamChatLocalizations(locale, translations); - } + final String _localeName; /// A [LocalizationsDelegate] for [StreamChatLocalizations]. /// @@ -74,7 +85,7 @@ class GlobalStreamChatLocalizations implements StreamChatLocalizations { /// as the value of [MaterialApp.localizationsDelegates] to include /// the localizations for both the flutter and stream chat widget libraries. static const LocalizationsDelegate delegate = - _StreamChatLocalizationsDelegate(); + _StreamChatLocalizationsDelegate(); /// A value for [MaterialApp.localizationsDelegates] that's typically used by /// internationalized apps. @@ -92,20 +103,19 @@ class GlobalStreamChatLocalizations implements StreamChatLocalizations { /// localizationsDelegates: GlobalStreamChatLocalizations.delegates, /// supportedLocales: [ /// const Locale('en', 'US'), // English - /// const Locale('he', 'IL'), // Hebrew /// ], /// // ... /// ) /// ``` static const List delegates = [ - delegate, + GlobalStreamChatLocalizations.delegate, GlobalCupertinoLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ]; @override - String? translate(String key) => translations[key]; + String get launchUrlError; } class _StreamChatLocalizationsDelegate @@ -116,14 +126,25 @@ class _StreamChatLocalizationsDelegate bool isSupported(Locale locale) => kStreamChatSupportedLanguages.contains(locale.languageCode); + static final _loadedTranslations = + >{}; + @override - Future load(Locale locale) => - GlobalStreamChatLocalizations.load(locale); + Future load(Locale locale) { + assert(isSupported(locale), ''); + return _loadedTranslations.putIfAbsent( + locale, + () => + SynchronousFuture( + getStreamChatTranslation(locale)!, + ), + ); + } @override bool shouldReload(_StreamChatLocalizationsDelegate old) => false; @override - String toString() => 'StreamChatLocalizations.delegate(' + String toString() => 'GlobalStreamChatLocalizations.delegate(' '${kStreamChatSupportedLanguages.length} locales)'; } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart new file mode 100644 index 00000000..7566be30 --- /dev/null +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -0,0 +1,11 @@ +part of 'stream_chat_localizations.dart'; + +/// The translations for English (`en`). +class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { + /// Create an instance of the translation bundle for English. + const StreamChatLocalizationsEn({String localeName = 'en'}) + : super(localeName: localeName); + + @override + String get launchUrlError => 'Cannot launch the url'; +} diff --git a/packages/stream_chat_localizations/lib/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/stream_chat_localizations.dart index 9c1146d8..0cfb60ba 100644 --- a/packages/stream_chat_localizations/lib/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/stream_chat_localizations.dart @@ -1,4 +1,9 @@ /// Localizations for the StreamChat Flutter library. library stream_chat_localization; -export 'src/stream_chat_localizations.dart'; +export 'package:flutter_localizations/flutter_localizations.dart' + show + GlobalCupertinoLocalizations, + GlobalMaterialLocalizations, + GlobalWidgetsLocalizations; +export 'src/stream_chat_localizations.dart' hide getStreamChatTranslation; diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index 34986658..b755a6dd 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -18,40 +18,3 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/stream_chat_localizations/test/stream_chat_localization_test.dart b/packages/stream_chat_localizations/test/stream_chat_localization_test.dart index 9ea48cb5..0324dd17 100644 --- a/packages/stream_chat_localizations/test/stream_chat_localization_test.dart +++ b/packages/stream_chat_localizations/test/stream_chat_localization_test.dart @@ -1,12 +1,20 @@ +import 'dart:ui'; + import 'package:flutter_test/flutter_test.dart'; -import 'package:stream_chat_localization/stream_chat_localizations.dart'; +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; void main() { - test('adds one to input values', () { - final calculator = Calculator(); - expect(calculator.addOne(2), 3); - expect(calculator.addOne(-7), -6); - expect(calculator.addOne(0), 1); - }); + for (final language in kStreamChatSupportedLanguages) { + test('translations exist for $language', () async { + final locale = Locale(language); + expect( + GlobalStreamChatLocalizations.delegate.isSupported(locale), + isTrue, + ); + final localizations = + await GlobalStreamChatLocalizations.delegate.load(locale); + expect(localizations.launchUrlError, isNotNull); + }); + } } From ffb46ecdca728a39be4f51461a2a9ab2c97df411 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 8 Jul 2021 16:59:57 +0530 Subject: [PATCH 03/35] minor changes --- .../lib/src/stream_chat_localizations.dart | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index b0ca6cd5..bef008fd 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -30,15 +30,15 @@ const kStreamChatSupportedLanguages = {'en'}; /// Generally speaking, this method is only intended to be used by /// [GlobalStreamChatLocalizations.delegate]. GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) { + final languageCode = locale.languageCode; + assert( + kStreamChatSupportedLanguages.contains(languageCode), + 'getStreamChatTranslation() called for unsupported locale "$locale"', + ); switch (locale.languageCode) { case 'en': return const StreamChatLocalizationsEn(); } - assert( - false, - 'getStreamChatTranslation() called for unsupported locale "$locale"', - ); - return null; } /// Implementation of localized strings for the stream chat widgets @@ -85,7 +85,7 @@ abstract class GlobalStreamChatLocalizations /// as the value of [MaterialApp.localizationsDelegates] to include /// the localizations for both the flutter and stream chat widget libraries. static const LocalizationsDelegate delegate = - _StreamChatLocalizationsDelegate(); + _StreamChatLocalizationsDelegate(); /// A value for [MaterialApp.localizationsDelegates] that's typically used by /// internationalized apps. @@ -127,17 +127,16 @@ class _StreamChatLocalizationsDelegate kStreamChatSupportedLanguages.contains(locale.languageCode); static final _loadedTranslations = - >{}; + >{}; @override Future load(Locale locale) { assert(isSupported(locale), ''); return _loadedTranslations.putIfAbsent( locale, - () => - SynchronousFuture( - getStreamChatTranslation(locale)!, - ), + () => SynchronousFuture( + getStreamChatTranslation(locale)!, + ), ); } From a48389a814317ff8c52faf502cda7fbb4a7d59e9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 12 Jul 2021 15:01:36 +0530 Subject: [PATCH 04/35] add remaining translation strings Signed-off-by: xsahil03x --- .../attachment_upload_state_builder.dart | 3 +- .../lib/src/attachment/file_attachment.dart | 9 +- .../lib/src/attachment/giphy_attachment.dart | 17 +- .../lib/src/attachment_actions_modal.dart | 13 +- .../lib/src/channel_bottom_sheet.dart | 25 +- .../lib/src/channel_header.dart | 7 +- .../lib/src/channel_info.dart | 21 +- .../lib/src/channel_list_header.dart | 18 +- .../lib/src/channel_list_view.dart | 34 +- .../lib/src/channel_name.dart | 9 +- .../lib/src/channel_preview.dart | 5 +- .../lib/src/date_divider.dart | 5 +- .../lib/src/deleted_message.dart | 3 +- .../lib/src/extension.dart | 4 +- .../lib/src/full_screen_media.dart | 9 +- .../lib/src/image_footer.dart | 3 +- .../stream_chat_localizations.dart | 36 ++ .../lib/src/localization/translations.dart | 517 ++++++++++++++++++ .../lib/src/message_actions_modal.dart | 62 ++- .../lib/src/message_input.dart | 78 ++- .../lib/src/message_list_view.dart | 20 +- .../lib/src/message_reactions_modal.dart | 3 +- .../lib/src/message_search_item.dart | 3 +- .../lib/src/message_search_list_view.dart | 16 +- .../lib/src/message_text.dart | 3 - .../lib/src/message_widget.dart | 21 +- .../lib/src/stream_chat_localizations.dart | 96 ---- .../lib/src/thread_header.dart | 3 +- .../lib/src/typing_indicator.dart | 4 +- .../lib/src/user_item.dart | 8 +- .../lib/src/user_list_view.dart | 20 +- .../stream_chat_flutter/lib/src/utils.dart | 8 +- .../lib/stream_chat_flutter.dart | 2 +- .../lib/src/stream_chat_localizations.dart | 5 +- .../lib/src/stream_chat_localizations_en.dart | 315 +++++++++++ 35 files changed, 1104 insertions(+), 301 deletions(-) create mode 100644 packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart create mode 100644 packages/stream_chat_flutter/lib/src/localization/translations.dart delete mode 100644 packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart diff --git a/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart b/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart index 825def58..ebbaed7d 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/upload_progress_indicator.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget to build in progress typedef InProgressBuilder = Widget Function(BuildContext, int, int); @@ -226,7 +227,7 @@ class _FailedState extends StatelessWidget { horizontal: 12, ), child: Text( - 'UPLOAD ERROR', + context.translations.uploadErrorLabel, style: theme.textTheme.footnote.copyWith( color: theme.colorTheme.white, ), diff --git a/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart index 7ec5fb04..547c5821 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart @@ -7,9 +7,9 @@ import 'package:stream_chat_flutter/src/upload_progress_indicator.dart'; import 'package:stream_chat_flutter/src/utils.dart'; import 'package:stream_chat_flutter/src/video_thumbnail_image.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; -// ignore: always_use_package_imports -import 'attachment_widget.dart'; +import 'package:stream_chat_flutter/src/attachment/attachment_widget.dart'; /// Widget for displaying file attachments class FileAttachment extends AttachmentWidget { @@ -285,7 +285,10 @@ class FileAttachment extends AttachmentWidget { progressIndicatorColor: theme.colorTheme.accentBlue, ), success: () => Text(fileSize(size), style: textStyle), - failed: (_) => Text('UPLOAD ERROR', style: textStyle), + failed: (_) => Text( + context.translations.uploadErrorLabel, + style: textStyle, + ), ); } } diff --git a/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart index 1572061e..1ae03ca1 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart @@ -4,6 +4,7 @@ import 'package:shimmer/shimmer.dart'; import 'package:stream_chat_flutter/src/attachment/attachment_widget.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget for showing a GIF attachment class GiphyAttachment extends AttachmentWidget { @@ -71,9 +72,9 @@ class GiphyAttachment extends AttachmentWidget { children: [ StreamSvgIcon.giphyIcon(), const SizedBox(width: 8), - const Text( - 'Giphy', - style: TextStyle(fontWeight: FontWeight.bold), + Text( + context.translations.giphyLabel, + style: const TextStyle(fontWeight: FontWeight.bold), ), const SizedBox(width: 8), if (attachment.title != null) @@ -134,7 +135,7 @@ class GiphyAttachment extends AttachmentWidget { }); }, child: Text( - 'Cancel', + context.translations.cancelLabel.toLowerCase(), style: StreamChatTheme.of(context) .textTheme .bodyBold @@ -166,7 +167,7 @@ class GiphyAttachment extends AttachmentWidget { }); }, child: Text( - 'Shuffle', + context.translations.shuffleLabel, style: StreamChatTheme.of(context) .textTheme .bodyBold @@ -199,7 +200,7 @@ class GiphyAttachment extends AttachmentWidget { }); }, child: Text( - 'Send', + context.translations.sendLabel, style: TextStyle( color: StreamChatTheme.of(context) .colorTheme @@ -234,7 +235,7 @@ class GiphyAttachment extends AttachmentWidget { width: 8, ), Text( - 'Only visible to you', + context.translations.onlyVisibleToYouText, style: StreamChatTheme.of(context) .textTheme .footnote @@ -339,7 +340,7 @@ class GiphyAttachment extends AttachmentWidget { size: 16, ), Text( - 'GIPHY', + context.translations.giphyLabel.toUpperCase(), style: TextStyle( color: StreamChatTheme.of(context).colorTheme.white, fontWeight: FontWeight.bold, diff --git a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart index 363fac45..48eea143 100644 --- a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart @@ -48,7 +48,7 @@ class AttachmentActionsModal extends StatelessWidget { child: _buildPage(context), ); - Widget _buildPage(context) { + Widget _buildPage(BuildContext context) { final theme = StreamChatTheme.of(context); return Column( crossAxisAlignment: CrossAxisAlignment.end, @@ -69,7 +69,7 @@ class AttachmentActionsModal extends StatelessWidget { children: [ _buildButton( context, - 'Reply', + context.translations.replyLabel, StreamSvgIcon.iconCurveLineLeftUp( size: 24, color: theme.colorTheme.grey, @@ -80,7 +80,7 @@ class AttachmentActionsModal extends StatelessWidget { ), _buildButton( context, - 'Show in Chat', + context.translations.showInChatLabel, StreamSvgIcon.eye( size: 24, color: theme.colorTheme.black, @@ -89,8 +89,9 @@ class AttachmentActionsModal extends StatelessWidget { ), _buildButton( context, - // ignore: lines_longer_than_80_chars - 'Save ${message.attachments[currentIndex].type == 'video' ? 'Video' : 'Image'}', + message.attachments[currentIndex].type == 'video' + ? context.translations.saveVideoLabel + : context.translations.saveImageLabel, StreamSvgIcon.iconSave( size: 24, color: theme.colorTheme.grey, @@ -141,7 +142,7 @@ class AttachmentActionsModal extends StatelessWidget { if (StreamChat.of(context).user?.id == message.user?.id) _buildButton( context, - 'Delete', + context.translations.deleteLabel, StreamSvgIcon.delete( size: 24, color: theme.colorTheme.accentRed, diff --git a/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart b/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart index eaabb7e2..9a8a3d1a 100644 --- a/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart +++ b/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/channel_info.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Bottom Sheet with options class ChannelBottomSheet extends StatefulWidget { @@ -149,7 +150,7 @@ class _ChannelBottomSheetState extends State { color: _streamChatThemeData.colorTheme.grey, ), ), - title: 'View Info', + title: context.translations.viewInfoLabel, onTap: widget.onViewInfoTap, ), if (!channel.isDistinct) @@ -160,7 +161,7 @@ class _ChannelBottomSheetState extends State { color: _streamChatThemeData.colorTheme.grey, ), ), - title: 'Leave Group', + title: context.translations.leaveGroupLabel, onTap: () async { setState(() { _showActions = false; @@ -179,7 +180,7 @@ class _ChannelBottomSheetState extends State { color: _streamChatThemeData.colorTheme.accentRed, ), ), - title: 'Delete Conversation', + title: context.translations.deleteConversationLabel, titleColor: _streamChatThemeData.colorTheme.accentRed, onTap: () async { setState(() { @@ -198,7 +199,7 @@ class _ChannelBottomSheetState extends State { color: _streamChatThemeData.colorTheme.grey, ), ), - title: 'Cancel', + title: context.translations.cancelLabel, onTap: () { Navigator.pop(context); }, @@ -219,10 +220,10 @@ class _ChannelBottomSheetState extends State { Future _showDeleteDialog() async { final res = await showConfirmationDialog( context, - title: 'Delete Conversation', - okText: 'DELETE', - question: 'Are you sure you want to delete this conversation?', - cancelText: 'CANCEL', + title: context.translations.deleteConversationLabel, + okText: context.translations.deleteLabel, + question: context.translations.deleteConversationQuestion, + cancelText: context.translations.cancelLabel, icon: StreamSvgIcon.delete( color: _streamChatThemeData.colorTheme.accentRed, ), @@ -237,10 +238,10 @@ class _ChannelBottomSheetState extends State { Future _showLeaveDialog() async { final res = await showConfirmationDialog( context, - title: 'Leave conversation', - okText: 'LEAVE', - question: 'Are you sure you want to leave this conversation?', - cancelText: 'CANCEL', + title: context.translations.leaveConversationLabel, + okText: context.translations.leaveLabel, + question: context.translations.leaveConversationQuestion, + cancelText: context.translations.cancelLabel, icon: StreamSvgIcon.userRemove( color: _streamChatThemeData.colorTheme.accentRed, ), diff --git a/packages/stream_chat_flutter/lib/src/channel_header.dart b/packages/stream_chat_flutter/lib/src/channel_header.dart index 16c1f1b7..a844af1c 100644 --- a/packages/stream_chat_flutter/lib/src/channel_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_header.dart @@ -6,6 +6,7 @@ import 'package:stream_chat_flutter/src/info_tile.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_header.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_header_paint.png) @@ -121,14 +122,14 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget { switch (status) { case ConnectionStatus.connected: - statusString = 'Connected'; + statusString = context.translations.connectedLabel; showStatus = false; break; case ConnectionStatus.connecting: - statusString = 'Reconnecting...'; + statusString = context.translations.reconnectingLabel; break; case ConnectionStatus.disconnected: - statusString = 'Disconnected'; + statusString = context.translations.disconnectedLabel; break; } diff --git a/packages/stream_chat_flutter/lib/src/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel_info.dart index 07920b95..c4ea92c9 100644 --- a/packages/stream_chat_flutter/lib/src/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel_info.dart @@ -2,6 +2,7 @@ import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget which shows channel info class ChannelInfo extends StatelessWidget { @@ -55,10 +56,13 @@ class ChannelInfo extends StatelessWidget { ) { Widget? alternativeWidget; - if (channel.memberCount != null && channel.memberCount! > 2) { - var text = '${channel.memberCount} Members'; + final memberCount = channel.memberCount; + if (memberCount != null && memberCount > 2) { + var text = context.translations.membersCountText(memberCount); final watcherCount = channel.state?.watcherCount ?? 0; - if (watcherCount > 0) text += ' $watcherCount Online'; + if (watcherCount > 0) { + text += ' ${context.translations.watchersCountText(watcherCount)}'; + } alternativeWidget = Text( text, style: StreamChatTheme.of(context) @@ -75,12 +79,13 @@ class ChannelInfo extends StatelessWidget { if (otherMember != null) { if (otherMember.user?.online == true) { alternativeWidget = Text( - 'Online', + context.translations.userOnlineText, style: textStyle, ); } else { alternativeWidget = Text( - 'Last seen ${Jiffy(otherMember.user?.lastActive).fromNow()}', + context.translations.userLastOnlineText + + Jiffy(otherMember.user?.lastActive).fromNow(), style: textStyle, ); } @@ -111,7 +116,7 @@ class ChannelInfo extends StatelessWidget { ), const SizedBox(width: 10), Text( - 'Searching for Network', + context.translations.searchingForNetworkLabel, style: textStyle, ), ], @@ -125,7 +130,7 @@ class ChannelInfo extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'Offline...', + context.translations.offlineLabel, style: textStyle, ), TextButton( @@ -141,7 +146,7 @@ class ChannelInfo extends StatelessWidget { ..closeConnection() ..openConnection(), child: Text( - 'Try Again', + context.translations.tryAgainLabel, style: textStyle?.copyWith( color: StreamChatTheme.of(context).colorTheme.accentBlue, ), diff --git a/packages/stream_chat_flutter/lib/src/channel_list_header.dart b/packages/stream_chat_flutter/lib/src/channel_list_header.dart index 5a4275a6..6c3eea20 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_header.dart @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:stream_chat_flutter/src/stream_neumorphic_button.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget builder for title typedef TitleBuilder = Widget Function( @@ -103,21 +104,20 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { switch (status) { case ConnectionStatus.connected: - statusString = 'Connected'; + statusString = context.translations.connectedLabel; showStatus = false; break; case ConnectionStatus.connecting: - statusString = 'Reconnecting...'; + statusString = context.translations.reconnectingLabel; break; case ConnectionStatus.disconnected: - statusString = 'Disconnected'; + statusString = context.translations.disconnectedLabel; break; } final chatThemeData = StreamChatTheme.of(context); return InfoTile( - // ignore: avoid_bool_literals_in_conditional_expressions - showMessage: showConnectionStateTile ? showStatus : false, + showMessage: showConnectionStateTile && showStatus, message: statusString, child: AppBar( textTheme: Theme.of(context).textTheme, @@ -207,7 +207,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { Widget _buildConnectedTitleState(BuildContext context) { final chatThemeData = StreamChatTheme.of(context); return Text( - 'Stream Chat', + context.translations.streamChatLabel, style: chatThemeData.textTheme.headlineBold.copyWith( color: chatThemeData.colorTheme.black, ), @@ -226,7 +226,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { ), const SizedBox(width: 10), Text( - 'Searching for Network', + context.translations.searchingForNetworkLabel, style: StreamChatTheme.of(context) .channelListHeaderTheme .title @@ -247,7 +247,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'Offline...', + context.translations.offlineLabel, style: chatThemeData.channelListHeaderTheme.title?.copyWith( fontSize: 16, fontWeight: FontWeight.bold, @@ -258,7 +258,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { ..closeConnection() ..openConnection(), child: Text( - 'Try Again', + context.translations.tryAgainLabel, style: chatThemeData.channelListHeaderTheme.title?.copyWith( fontSize: 16, fontWeight: FontWeight.bold, diff --git a/packages/stream_chat_flutter/lib/src/channel_list_view.dart b/packages/stream_chat_flutter/lib/src/channel_list_view.dart index b14e0b75..847a265b 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_view.dart @@ -7,6 +7,7 @@ import 'package:stream_chat_flutter/src/channel_bottom_sheet.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Callback called when tapping on a channel typedef ChannelTapCallback = void Function(Channel, Widget?); @@ -202,6 +203,7 @@ class _ChannelListViewState extends State { final _slideController = SlidableController(); late final _defaultController = ChannelListController(); + ChannelListController get _channelListController => widget.channelListController ?? _defaultController; @@ -296,7 +298,7 @@ class _ChannelListViewState extends State { Padding( padding: const EdgeInsets.all(8), child: Text( - 'Let’s start chatting!', + context.translations.letsStartChattingLabel, style: chatThemeData.textTheme.headline, ), ), @@ -306,7 +308,7 @@ class _ChannelListViewState extends State { horizontal: 52, ), child: Text( - 'How about sending your first message to a friend?', + context.translations.sendingFirstMessageLabel, textAlign: TextAlign.center, style: chatThemeData.textTheme.body.copyWith( color: chatThemeData.colorTheme.grey, @@ -325,7 +327,7 @@ class _ChannelListViewState extends State { child: TextButton( onPressed: widget.onStartChatPressed, child: Text( - 'Start a chat', + context.translations.startAChatLabel, style: chatThemeData.textTheme.bodyBold.copyWith( color: chatThemeData.colorTheme.accentBlue, ), @@ -461,9 +463,9 @@ class _ChannelListViewState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text.rich( - const TextSpan( + TextSpan( children: [ - WidgetSpan( + const WidgetSpan( child: Padding( padding: EdgeInsets.only( right: 2, @@ -471,14 +473,14 @@ class _ChannelListViewState extends State { child: Icon(Icons.error_outline), ), ), - TextSpan(text: 'Error loading channels'), + TextSpan(text: context.translations.loadingChannelsError), ], ), style: Theme.of(context).textTheme.headline6, ), TextButton( onPressed: () => _channelListController.loadData!(), - child: const Text('Retry'), + child: Text(context.translations.retryLabel), ), ], ), @@ -558,12 +560,12 @@ class _ChannelListViewState extends State { : () async { final res = await showConfirmationDialog( context, - title: 'Delete Conversation', - okText: 'DELETE', - question: - // ignore: lines_longer_than_80_chars - 'Are you sure you want to delete this conversation?', - cancelText: 'CANCEL', + title: + context.translations.deleteConversationLabel, + question: context + .translations.deleteConversationQuestion, + okText: context.translations.deleteLabel, + cancelText: context.translations.cancelLabel, icon: StreamSvgIcon.delete( color: chatThemeData.colorTheme.accentRed, ), @@ -666,10 +668,10 @@ class _ChannelListViewState extends State { .colorTheme .accentRed .withOpacity(.2), - child: const Padding( - padding: EdgeInsets.symmetric(vertical: 16), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), child: Center( - child: Text('Error loading channels'), + child: Text(context.translations.loadingChannelsError), ), ), ), diff --git a/packages/stream_chat_flutter/lib/src/channel_name.dart b/packages/stream_chat_flutter/lib/src/channel_name.dart index 4819ecc7..ef5dcdee 100644 --- a/packages/stream_chat_flutter/lib/src/channel_name.dart +++ b/packages/stream_chat_flutter/lib/src/channel_name.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// It shows the current [Channel] name using a [Text] widget. /// @@ -44,8 +45,10 @@ class ChannelName extends StatelessWidget { ) => LayoutBuilder( builder: (context, constraints) { - var title = 'No title'; - if (extraData['name'] == null) { + var title = context.translations.noTitleText; + if (extraData['name'] != null) { + title = extraData['name']; + } else { final otherMembers = members?.where((member) => member.userId != client.user!.id); if (otherMembers?.length == 1) { @@ -71,8 +74,6 @@ class ChannelName extends StatelessWidget { title = '${currentMembers.map((e) => e.user?.name).join(', ')} ' '${exceedingMembers > 0 ? '+ $exceedingMembers' : ''}'; } - } else { - title = extraData['name']; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/channel_preview.dart b/packages/stream_chat_flutter/lib/src/channel_preview.dart index 231b5f94..f21625c6 100644 --- a/packages/stream_chat_flutter/lib/src/channel_preview.dart +++ b/packages/stream_chat_flutter/lib/src/channel_preview.dart @@ -6,6 +6,7 @@ import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_preview.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_preview_paint.png) @@ -183,7 +184,7 @@ class ChannelPreview extends StatelessWidget { startOfDay .subtract(const Duration(days: 1)) .millisecondsSinceEpoch) { - stringDate = 'Yesterday'; + stringDate = context.translations.yesterdayLabel; } else if (startOfDay.difference(lastMessageAt).inDays < 7) { stringDate = Jiffy(lastMessageAt.toLocal()).EEEE; } else { @@ -208,7 +209,7 @@ class ChannelPreview extends StatelessWidget { size: 16, ), Text( - ' Channel is muted', + context.translations.channelIsMutedText, style: chatThemeData.channelPreviewTheme.subtitle, ), ], diff --git a/packages/stream_chat_flutter/lib/src/date_divider.dart b/packages/stream_chat_flutter/lib/src/date_divider.dart index 185683be..e23f0233 100644 --- a/packages/stream_chat_flutter/lib/src/date_divider.dart +++ b/packages/stream_chat_flutter/lib/src/date_divider.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// It shows a date divider depending on the date difference class DateDivider extends StatelessWidget { @@ -24,10 +25,10 @@ class DateDivider extends StatelessWidget { String dayInfo; if (Jiffy(createdAt).isSame(now, Units.DAY)) { - dayInfo = 'Today'; + dayInfo = context.translations.todayLabel; } else if (Jiffy(createdAt) .isSame(now.subtract(const Duration(days: 1)), Units.DAY)) { - dayInfo = 'Yesterday'; + dayInfo = context.translations.yesterdayLabel; } else if (Jiffy(createdAt).isAfter( now.subtract(const Duration(days: 7)), Units.DAY, diff --git a/packages/stream_chat_flutter/lib/src/deleted_message.dart b/packages/stream_chat_flutter/lib/src/deleted_message.dart index 9a4e0ae2..e62a7cfa 100644 --- a/packages/stream_chat_flutter/lib/src/deleted_message.dart +++ b/packages/stream_chat_flutter/lib/src/deleted_message.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget to display deleted message class DeletedMessage extends StatelessWidget { @@ -49,7 +50,7 @@ class DeletedMessage extends StatelessWidget { horizontal: 16, ), child: Text( - 'Message deleted', + context.translations.messageDeletedLabel, style: messageTheme.messageText?.copyWith( fontStyle: FontStyle.italic, color: messageTheme.createdAt?.color, diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index 3a495ca5..b185ae3b 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -2,6 +2,7 @@ import 'package:characters/characters.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/emoji/emoji.dart'; +import 'package:stream_chat_flutter/src/localization/translations.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; final _emojiChars = Emoji.chars(); @@ -104,7 +105,8 @@ extension BuildContextX on BuildContext { double get textScaleFactor => MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0; - StreamChatLocalizations? get translations => StreamChatLocalizations.of(this); + Translations get translations => + StreamChatLocalizations.of(this) ?? DefaultTranslations.instance; } /// Extension on [BorderRadius] diff --git a/packages/stream_chat_flutter/lib/src/full_screen_media.dart b/packages/stream_chat_flutter/lib/src/full_screen_media.dart index f86ac60b..6810816f 100644 --- a/packages/stream_chat_flutter/lib/src/full_screen_media.dart +++ b/packages/stream_chat_flutter/lib/src/full_screen_media.dart @@ -10,6 +10,7 @@ import 'package:stream_chat_flutter/src/image_footer.dart'; import 'package:stream_chat_flutter/src/image_header.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:video_player/video_player.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Return action for coming back from pages enum ReturnActionType { @@ -182,9 +183,11 @@ class _FullScreenMediaState extends State children: [ ImageHeader( userName: widget.userName, - sentAt: - // ignore: lines_longer_than_80_chars - 'Sent ${getDay(widget.message.createdAt.toLocal())} at ${Jiffy(widget.message.createdAt.toLocal()).format('HH:mm')}', + // TODO: Fix this + sentAt: context.translations.sentAtText( + date: widget.message.createdAt, + time: widget.message.createdAt, + ), onBackPressed: () { Navigator.of(context).pop(); }, diff --git a/packages/stream_chat_flutter/lib/src/image_footer.dart b/packages/stream_chat_flutter/lib/src/image_footer.dart index 0a6571cc..3d12bf94 100644 --- a/packages/stream_chat_flutter/lib/src/image_footer.dart +++ b/packages/stream_chat_flutter/lib/src/image_footer.dart @@ -11,6 +11,7 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/src/video_thumbnail_image.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Footer widget for media display class ImageFooter extends StatefulWidget implements PreferredSizeWidget { @@ -190,7 +191,7 @@ class _ImageFooterState extends State { child: Padding( padding: const EdgeInsets.all(16), child: Text( - 'Photos', + context.translations.photosLabel, style: chatThemeData.textTheme.headlineBold, ), ), diff --git a/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart b/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart new file mode 100644 index 00000000..b2a1bd5e --- /dev/null +++ b/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart @@ -0,0 +1,36 @@ +import 'package:flutter/widgets.dart'; + +import 'package:stream_chat_flutter/src/localization/translations.dart' + show Translations; + +/// Defines the localized resource values used by the StreamChatFlutter widgets. +/// +/// See also: +/// +/// * [GlobalStreamChatLocalizations], which provides material localizations +/// for many languages. +abstract class StreamChatLocalizations implements Translations { + /// The `StreamChatLocalizations` from the closest [Localizations] instance + /// that encloses the given context. + /// + /// If no [StreamChatLocalizations] are available in the given `context`, this + /// method returns null. + /// + /// This method is just a convenient shorthand for: + /// `Localizations.of( + /// context, + /// StreamChatLocalizations + /// )`. + /// + /// References to the localized resources defined by this class are typically + /// written in terms of this method. For example: + /// + /// ```dart + /// tooltip: StreamChatLocalizations.of(context).streamChatLabel, + /// ``` + static StreamChatLocalizations? of(BuildContext context) => + Localizations.of( + context, + StreamChatLocalizations, + ); +} diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart new file mode 100644 index 00000000..651f97f8 --- /dev/null +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -0,0 +1,517 @@ +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart' + show User; + +abstract class Translations { + String get launchUrlError; + + String get loadingUsersError; + + String get retryLabel; + + String get noUsersLabel; + + String get userOnlineText; + + String get userLastOnlineText; + + String userTypingText(Iterable users); + + String get threadReplyLabel; + + String get onlyVisibleToYouText; + + String threadReplyCountText(int count); + + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }); + + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }); + + String get emptyMessagesText; + + String get genericErrorText; + + String get loadingMessagesError; + + String resultCountText(int count); + + String get messageDeletedText; + + String get messageDeletedLabel; + + String get messageReactionsText; + + String get emptyChatMessagesText; + + String threadSeparatorText(int replyCount); + + String get connectedLabel; + + String get disconnectedLabel; + + String get reconnectingLabel; + + String get alsoSendAsDirectMessageLabel; + + String get searchGifLabel; + + String get addACommentOrSendLabel; + + String get writeAMessageLabel; + + String get instantCommandsLabel; + + String get fileTooLargeAfterCompressionError; + + String get fileTooLargeError; + + String emojiMatchingQueryText(String query); + + String get addAFileLabel; + + String get uploadAPhotoLabel; + + String get uploadAVideoLabel; + + String get photoFromCameraLabel; + + String get videoFromCameraLabel; + + String get uploadAFileLabel; + + String get somethingWentWrongLabel; + + String get okLabel; + + String get addMoreFilesLabel; + + String get enablePhotoAndVideoAccessMessage; + + String get allowGalleryAccessMessage; + + String get flagMessageLabel; + + String get flagMessageQuestion; + + String get flagLabel; + + String get cancelLabel; + + String get flagMessageSuccessfulLabel; + + String get flagMessageSuccessfulText; + + String get deleteMessageLabel; + + String get deleteMessageQuestion; + + String get deleteLabel; + + String get operationCouldNotBeCompletedText; + + String get replyLabel; + + String togglePinUnpinText({required bool pinned}); + + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}); + + String get copyMessageLabel; + + String get editMessageLabel; + + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}); + + String get photosLabel; + + String sentAtText({required DateTime date, required DateTime time}); + + String get todayLabel; + + String get yesterdayLabel; + + String get channelIsMutedText; + + String get noTitleText; + + String get letsStartChattingLabel; + + String get sendingFirstMessageLabel; + + String get startAChatLabel; + + String get loadingChannelsError; + + // title: 'Delete Conversation', +// okText: 'DELETE', +// question: +// 'Are you sure you want to delete this conversation?', + + String get deleteConversationLabel; + + String get deleteConversationQuestion; + + String get streamChatLabel; + + String get searchingForNetworkLabel; + + String get offlineLabel; + + String get tryAgainLabel; + + String membersCountText(int count); + + String watchersCountText(int count); + + String get viewInfoLabel; + + String get leaveGroupLabel; + + String get leaveLabel; + + String get leaveConversationLabel; + + String get leaveConversationQuestion; + + String get showInChatLabel; + + String get saveImageLabel; + + String get saveVideoLabel; + + String get uploadErrorLabel; + + String get giphyLabel; + + String get shuffleLabel; + + String get sendLabel; +} + +class DefaultTranslations implements Translations { + const DefaultTranslations._(); + + static const instance = DefaultTranslations._(); + + @override + String get launchUrlError => 'Cannot launch the url'; + + @override + String get loadingUsersError => 'Error loading users'; + + @override + String get noUsersLabel => 'There are no users currently'; + + @override + String get retryLabel => 'Retry'; + + @override + String get userLastOnlineText => 'Last online'; + + @override + String get userOnlineText => 'Online'; + + @override + String userTypingText(Iterable users) { + if (users.isEmpty) return ''; + final first = users.first; + if (users.length == 1) { + return '${first.name} is typing'; + } + return '${first.name} and ${users.length - 1} more are typing'; + } + + @override + String get threadReplyLabel => 'Thread Reply'; + + @override + String get onlyVisibleToYouText => 'Only visible to you'; + + @override + String threadReplyCountText(int count) => '$count Thread Replies'; + + @override + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }) => + 'Uploading $remaining/$total ...'; + + @override + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }) { + final pinnedByCurrentUser = currentUser.id == pinnedBy.id; + if (pinnedByCurrentUser) return 'Pinned by You'; + return 'Pinned by ${pinnedBy.name}'; + } + + @override + String get emptyMessagesText => 'There are no messages currently'; + + @override + String get genericErrorText => 'Something went wrong'; + + @override + String get loadingMessagesError => 'Error loading messages'; + + @override + String resultCountText(int count) => '$count results'; + + @override + String get messageDeletedText => 'This message was deleted.'; + + @override + String get messageDeletedLabel => 'Message deleted'; + + @override + String get messageReactionsText => 'Message Reactions'; + + @override + String get emptyChatMessagesText => 'No chats here yet...'; + + @override + String threadSeparatorText(int replyCount) { + if (replyCount == 1) return '1 Reply'; + return '$replyCount Replies'; + } + + @override + String get connectedLabel => 'Connected'; + + @override + String get disconnectedLabel => 'Disconnected'; + + @override + String get reconnectingLabel => 'Reconnecting...'; + + @override + String get alsoSendAsDirectMessageLabel => 'Also send as direct message'; + + @override + String get addACommentOrSendLabel => 'Add a comment or send'; + + @override + String get searchGifLabel => 'Search GIFs'; + + @override + String get writeAMessageLabel => 'Write a message'; + + @override + String get instantCommandsLabel => 'Instant Commands'; + + @override + String get fileTooLargeAfterCompressionError => + 'The file is too large to upload. ' + 'The file size limit is 20MB. ' + 'We tried compressing it, but it was not enough.'; + + @override + String get fileTooLargeError => + 'The file is too large to upload. The file size limit is 20MB.'; + + @override + String emojiMatchingQueryText(String query) => 'Emoji matching "$query"'; + + @override + String get addAFileLabel => 'Add a file'; + + @override + String get photoFromCameraLabel => 'Photo from camera'; + + @override + String get uploadAFileLabel => 'Upload a file'; + + @override + String get uploadAPhotoLabel => 'Upload a photo'; + + @override + String get uploadAVideoLabel => 'Upload a video'; + + @override + String get videoFromCameraLabel => 'Video from camera'; + + @override + String get okLabel => 'OK'; + + @override + String get somethingWentWrongLabel => 'Something went wrong'; + + @override + String get addMoreFilesLabel => 'Add more files'; + + @override + String get enablePhotoAndVideoAccessMessage => + 'Please enable access to your photos' + '\nand videos so you can share them with friends.'; + + @override + String get allowGalleryAccessMessage => 'Allow access to your gallery'; + + @override + String get flagMessageLabel => 'Flag Message'; + + @override + String get flagMessageQuestion => + 'Do you want to send a copy of this message to a' + '\nmoderator for further investigation?'; + + @override + String get flagLabel => 'FLAG'; + + @override + String get cancelLabel => 'CANCEL'; + + @override + String get flagMessageSuccessfulLabel => 'Message flagged'; + + @override + String get flagMessageSuccessfulText => + 'The message has been reported to a moderator.'; + + @override + String get deleteLabel => 'DELETE'; + + @override + String get deleteMessageLabel => 'Delete Message'; + + @override + String get deleteMessageQuestion => + 'Are you sure you want to permanently delete this\nmessage?'; + + @override + String get operationCouldNotBeCompletedText => + 'The operation couldn\'t be completed.'; + + @override + String get replyLabel => 'Reply'; + + @override + String togglePinUnpinText({required bool pinned}) { + if (pinned) return 'Unpin from Conversation'; + return 'Pin to Conversation'; + } + + @override + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}) { + if (isDeleteFailed) return 'Retry Deleting Message'; + return 'Delete Message'; + } + + @override + String get copyMessageLabel => 'Copy Message'; + + @override + String get editMessageLabel => 'Edit Message'; + + @override + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}) { + if (isUpdateFailed) return 'Resend Edited Message'; + return 'Resend'; + } + + @override + String get photosLabel => 'Photos'; + + @override + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent $date at $time'; + + @override + String get todayLabel => 'Today'; + + @override + String get yesterdayLabel => 'Yesterday'; + + @override + String get channelIsMutedText => ' Channel is muted'; + + @override + String get noTitleText => 'No title'; + + @override + String get letsStartChattingLabel => 'Let’s start chatting!'; + + @override + String get sendingFirstMessageLabel => + 'How about sending your first message to a friend?'; + + @override + String get startAChatLabel => 'Start a chat'; + + @override + String get loadingChannelsError => 'Error loading channels'; + + @override + String get deleteConversationLabel => 'Delete Conversation'; + + @override + String get deleteConversationQuestion => + 'Are you sure you want to delete this conversation?'; + + @override + String get streamChatLabel => 'Stream Chat'; + + @override + String get searchingForNetworkLabel => 'Searching for Network'; + + @override + String get offlineLabel => 'Offline...'; + + @override + String get tryAgainLabel => 'Try Again'; + + @override + String membersCountText(int count) { + if (count == 1) return '1 Member'; + return '$count Members'; + } + + @override + String watchersCountText(int count) { + if (count == 1) return '1 Online'; + return '$count Online'; + } + + @override + String get viewInfoLabel => 'View Info'; + + @override + String get leaveGroupLabel => 'Leave Group'; + + @override + String get leaveLabel => 'LEAVE'; + + @override + String get leaveConversationLabel => 'Leave conversation'; + + @override + String get leaveConversationQuestion => + 'Are you sure you want to leave this conversation?'; + + @override + String get showInChatLabel => 'Show in Chat'; + + @override + String get saveImageLabel => 'Save Image'; + + @override + String get saveVideoLabel => 'Save Video'; + + @override + String get uploadErrorLabel => 'UPLOAD ERROR'; + + @override + String get giphyLabel => 'Giphy'; + + @override + String get shuffleLabel => 'Shuffle'; + + @override + String get sendLabel => 'Send'; +} diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart index 296b1e59..b7ba4655 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart @@ -268,16 +268,14 @@ class _MessageActionsModalState extends State { final streamChatThemeData = StreamChatTheme.of(context); final answer = await showConfirmationDialog( context, - title: 'Flag Message', + title: context.translations.flagMessageLabel, icon: StreamSvgIcon.flag( color: streamChatThemeData.colorTheme.accentRed, size: 24, ), - question: - // ignore: lines_longer_than_80_chars - 'Do you want to send a copy of this message to a\nmoderator for further investigation?', - okText: 'FLAG', - cancelText: 'CANCEL', + question: context.translations.flagMessageQuestion, + okText: context.translations.okLabel, + cancelText: context.translations.cancelLabel, ); final theme = streamChatThemeData; @@ -290,9 +288,9 @@ class _MessageActionsModalState extends State { color: theme.colorTheme.accentRed, size: 24, ), - details: 'The message has been reported to a moderator.', - title: 'Message flagged', - okText: 'OK', + details: context.translations.flagMessageSuccessfulText, + title: context.translations.flagMessageSuccessfulLabel, + okText: context.translations.okLabel, ); } catch (err) { if (err is StreamChatNetworkError && @@ -303,9 +301,9 @@ class _MessageActionsModalState extends State { color: theme.colorTheme.accentRed, size: 24, ), - details: 'The message has been reported to a moderator.', - title: 'Message flagged', - okText: 'OK', + details: context.translations.flagMessageSuccessfulText, + title: context.translations.flagMessageSuccessfulLabel, + okText: context.translations.okLabel, ); } else { _showErrorAlert(); @@ -335,14 +333,14 @@ class _MessageActionsModalState extends State { }); final answer = await showConfirmationDialog( context, - title: 'Delete message', + title: context.translations.deleteMessageLabel, icon: StreamSvgIcon.flag( color: StreamChatTheme.of(context).colorTheme.accentRed, size: 24, ), - question: 'Are you sure you want to permanently delete this\nmessage?', - okText: 'DELETE', - cancelText: 'CANCEL', + question: context.translations.deleteMessageQuestion, + okText: context.translations.deleteLabel, + cancelText: context.translations.cancelLabel, ); if (answer == true) { @@ -366,9 +364,9 @@ class _MessageActionsModalState extends State { color: StreamChatTheme.of(context).colorTheme.accentRed, size: 24, ), - details: 'The operation couldn\'t be completed.', - title: 'Something went wrong', - okText: 'OK', + details: context.translations.operationCouldNotBeCompletedText, + title: context.translations.somethingWentWrongLabel, + okText: context.translations.okLabel, ); } @@ -390,7 +388,7 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - 'Reply', + context.translations.replyLabel, style: streamChatThemeData.textTheme.body, ), ], @@ -412,7 +410,7 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - 'Flag Message', + context.translations.flagMessageLabel, style: streamChatThemeData.textTheme.body, ), ], @@ -435,7 +433,9 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - '${widget.message.pinned ? 'Unpin from' : 'Pin to'} Conversation', + context.translations.togglePinUnpinText( + pinned: widget.message.pinned, + ), style: streamChatThemeData.textTheme.body, ), ], @@ -458,7 +458,9 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - isDeleteFailed ? 'Retry Deleting Message' : 'Delete Message', + context.translations.toggleDeleteRetryDeleteMessageText( + isDeleteFailed: isDeleteFailed, + ), style: StreamChatTheme.of(context) .textTheme .body @@ -487,7 +489,7 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - 'Copy Message', + context.translations.copyMessageLabel, style: streamChatThemeData.textTheme.body, ), ], @@ -512,7 +514,7 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - 'Edit Message', + context.translations.editMessageLabel, style: streamChatThemeData.textTheme.body, ), ], @@ -544,7 +546,9 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - isUpdateFailed ? 'Resend Edited Message' : 'Resend', + context.translations.toggleResendOrResendEditedMessage( + isUpdateFailed: isUpdateFailed, + ), style: streamChatThemeData.textTheme.body, ), ], @@ -588,8 +592,8 @@ class _MessageActionsModalState extends State { color: streamChatThemeData.colorTheme.greyGainsboro, ), ), - const Text( - 'Edit Message', + Text( + context.translations.editMessageLabel, style: TextStyle(fontWeight: FontWeight.bold), ), IconButton( @@ -636,7 +640,7 @@ class _MessageActionsModalState extends State { ), const SizedBox(width: 16), Text( - 'Thread Reply', + context.translations.threadReplyLabel, style: streamChatThemeData.textTheme.body, ), ], diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 39211116..8bea5313 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -24,6 +24,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:substring_highlight/substring_highlight.dart'; import 'package:video_compress/video_compress.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Builder for attachment thumbnails typedef AttachmentThumbnailBuilder = Widget Function( @@ -229,16 +230,12 @@ class MessageInput extends StatefulWidget { /// Use this method to get the current [StreamChatState] instance static MessageInputState of(BuildContext context) { MessageInputState? messageInputState; - messageInputState = context.findAncestorStateOfType(); - - if (messageInputState == null) { - throw Exception( - // ignore: lines_longer_than_80_chars - 'You must have a MessageInput widget as ancestor of your widget tree'); - } - - return messageInputState; + assert( + messageInputState != null, + 'You must have a MessageInput widget as ancestor of your widget tree', + ); + return messageInputState!; } } @@ -440,7 +437,7 @@ class MessageInputState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Text( - 'Also send as direct message', + context.translations.alsoSendAsDirectMessageLabel, style: _streamChatTheme.textTheme.footnote.copyWith( color: _streamChatTheme.colorTheme.black.withOpacity(0.5), ), @@ -564,7 +561,7 @@ class MessageInputState extends State { style: _streamChatTheme.messageInputTheme.inputTextStyle, autofocus: widget.autofocus, textAlignVertical: TextAlignVertical.center, - decoration: _getInputDecoration(), + decoration: _getInputDecoration(context), textCapitalization: TextCapitalization.sentences, ), ) @@ -576,11 +573,11 @@ class MessageInputState extends State { ); } - InputDecoration _getInputDecoration() { + InputDecoration _getInputDecoration(BuildContext context) { final passedDecoration = _streamChatTheme.messageInputTheme.inputDecoration; return InputDecoration( isDense: true, - hintText: _getHint(), + hintText: _getHint(context), hintStyle: _streamChatTheme.messageInputTheme.inputTextStyle!.copyWith( color: _streamChatTheme.colorTheme.grey, ), @@ -729,14 +726,14 @@ class MessageInputState extends State { ); } - String _getHint() { + String _getHint(BuildContext context) { if (_commandEnabled && _chosenCommand!.name == 'giphy') { - return 'Search GIFs'; + return context.translations.searchGifLabel; } if (_attachments.isNotEmpty) { - return 'Add a comment or send'; + return context.translations.addACommentOrSendLabel; } - return 'Write a message'; + return context.translations.writeAMessageLabel; } void _checkEmoji(String s, BuildContext context) { @@ -859,7 +856,7 @@ class MessageInputState extends State { ), ), Text( - 'Instant Commands', + context.translations.instantCommandsLabel, style: TextStyle( color: _streamChatTheme.colorTheme.black.withOpacity(.5), @@ -1114,8 +1111,7 @@ class MessageInputState extends State { if (mediaInfo.filesize! > widget.maxAttachmentSize) { _showErrorAlert( - // ignore: lines_longer_than_80_chars - 'The file is too large to upload. The file size limit is 20MB. We tried compressing it, but it was not enough.', + context.translations.fileTooLargeAfterCompressionError, ); return; } @@ -1126,9 +1122,7 @@ class MessageInputState extends State { path: mediaInfo.path, ); } else { - _showErrorAlert( - 'The file is too large to upload. The file size limit is 20MB.', - ); + _showErrorAlert(context.translations.fileTooLargeError); return; } } @@ -1396,7 +1390,9 @@ class MessageInputState extends State { ), Flexible( child: Text( - 'Emoji matching "$query"', + context.translations.emojiMatchingQueryText( + query, + ), style: TextStyle( color: _streamChatTheme.colorTheme.black .withOpacity(.5), @@ -1744,17 +1740,17 @@ class MessageInputState extends State { builder: (_) => Column( mainAxisSize: MainAxisSize.min, children: [ - const ListTile( + ListTile( title: Text( - 'Add a file', - style: TextStyle( + context.translations.addAFileLabel, + style: const TextStyle( fontWeight: FontWeight.bold, ), ), ), ListTile( leading: const Icon(Icons.image), - title: const Text('Upload a photo'), + title: Text(context.translations.uploadAPhotoLabel), onTap: () { pickFile(DefaultAttachmentTypes.image); Navigator.pop(context); @@ -1762,7 +1758,7 @@ class MessageInputState extends State { ), ListTile( leading: const Icon(Icons.video_library), - title: const Text('Upload a video'), + title: Text(context.translations.uploadAVideoLabel), onTap: () { pickFile(DefaultAttachmentTypes.video); Navigator.pop(context); @@ -1771,7 +1767,7 @@ class MessageInputState extends State { if (!kIsWeb) ListTile( leading: const Icon(Icons.camera_alt), - title: const Text('Photo from camera'), + title: Text(context.translations.photoFromCameraLabel), onTap: () { pickFile(DefaultAttachmentTypes.image, true); Navigator.pop(context); @@ -1780,7 +1776,7 @@ class MessageInputState extends State { if (!kIsWeb) ListTile( leading: const Icon(Icons.videocam), - title: const Text('Video from camera'), + title: Text(context.translations.videoFromCameraLabel), onTap: () { pickFile(DefaultAttachmentTypes.video, true); Navigator.pop(context); @@ -1788,7 +1784,7 @@ class MessageInputState extends State { ), ListTile( leading: const Icon(Icons.insert_drive_file), - title: const Text('Upload a file'), + title: Text(context.translations.uploadAFileLabel), onTap: () { pickFile(DefaultAttachmentTypes.file); Navigator.pop(context); @@ -1888,8 +1884,7 @@ class MessageInputState extends State { if (mediaInfo.filesize! > widget.maxAttachmentSize) { _showErrorAlert( - // ignore: lines_longer_than_80_chars - 'The file is too large to upload. The file size limit is 20MB. We tried compressing it, but it was not enough.', + context.translations.fileTooLargeAfterCompressionError, ); return; } @@ -1900,9 +1895,7 @@ class MessageInputState extends State { path: mediaInfo.path, ); } else { - _showErrorAlert( - 'The file is too large to upload. The file size limit is 20MB.', - ); + _showErrorAlert(context.translations.fileTooLargeError); return; } } @@ -2079,7 +2072,7 @@ class MessageInputState extends State { height: 26, ), Text( - 'Something went wrong', + context.translations.somethingWentWrongLabel, style: _streamChatTheme.textTheme.headlineBold, ), const SizedBox( @@ -2107,7 +2100,7 @@ class MessageInputState extends State { Navigator.of(context).pop(); }, child: Text( - 'OK', + context.translations.okLabel, style: _streamChatTheme.textTheme.bodyBold .copyWith(color: _streamChatTheme.colorTheme.accentBlue), ), @@ -2253,7 +2246,7 @@ class __PickerWidgetState extends State<_PickerWidget> { color: widget.streamChatTheme.colorTheme.whiteSmoke, alignment: Alignment.center, child: Text( - 'Add more files', + context.translations.addMoreFilesLabel, style: TextStyle( color: widget.streamChatTheme.colorTheme.accentBlue, fontWeight: FontWeight.bold, @@ -2285,8 +2278,7 @@ class __PickerWidgetState extends State<_PickerWidget> { color: widget.streamChatTheme.colorTheme.greyGainsboro, ), Text( - // ignore: lines_longer_than_80_chars - 'Please enable access to your photos \nand videos so you can share them with friends.', + context.translations.enablePhotoAndVideoAccessMessage, style: widget.streamChatTheme.textTheme.body.copyWith( color: widget.streamChatTheme.colorTheme.grey), textAlign: TextAlign.center, @@ -2294,7 +2286,7 @@ class __PickerWidgetState extends State<_PickerWidget> { const SizedBox(height: 6), Center( child: Text( - 'Allow access to your gallery', + context.translations.allowGalleryAccessMessage, style: widget.streamChatTheme.textTheme.bodyBold.copyWith( color: widget.streamChatTheme.colorTheme.accentBlue, ), diff --git a/packages/stream_chat_flutter/lib/src/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view.dart index e6bf7a17..72a2a314 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view.dart @@ -17,6 +17,7 @@ import 'package:stream_chat_flutter/src/system_message.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:visibility_detector/visibility_detector.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget builder for message /// [defaultMessageWidget] is the default [MessageWidget] configuration @@ -353,6 +354,7 @@ class _MessageListViewState extends State { bool _inBetweenList = false; late final _defaultController = MessageListController(); + MessageListController get _messageListController => widget.messageListController ?? _defaultController; @@ -366,7 +368,7 @@ class _MessageListViewState extends State { emptyBuilder: widget.emptyBuilder ?? (context) => Center( child: Text( - 'No chats here yet...', + context.translations.emptyChatMessagesText, style: _streamTheme.textTheme.footnote.copyWith( color: _streamTheme.colorTheme.black.withOpacity(.5)), ), @@ -378,7 +380,7 @@ class _MessageListViewState extends State { errorWidgetBuilder: widget.errorWidgetBuilder ?? (BuildContext context, Object error) => Center( child: Text( - 'Something went wrong', + context.translations.genericErrorText, style: _streamTheme.textTheme.footnote.copyWith( color: _streamTheme.colorTheme.black.withOpacity(.5)), ), @@ -423,14 +425,14 @@ class _MessageListViewState extends State { var showStatus = true; switch (status) { case ConnectionStatus.connected: - statusString = 'Connected'; + statusString = context.translations.connectedLabel; showStatus = false; break; case ConnectionStatus.connecting: - statusString = 'Reconnecting...'; + statusString = context.translations.reconnectingLabel; break; case ConnectionStatus.disconnected: - statusString = 'Disconnected'; + statusString = context.translations.disconnectedLabel; break; } @@ -619,7 +621,7 @@ class _MessageListViewState extends State { return widget.threadSeparatorBuilder!.call(context); } - final replyCount = widget.parentMessage!.replyCount; + final replyCount = widget.parentMessage!.replyCount!; return DecoratedBox( decoration: BoxDecoration( gradient: _streamTheme.colorTheme.bgGradient, @@ -627,7 +629,7 @@ class _MessageListViewState extends State { child: Padding( padding: const EdgeInsets.all(8), child: Text( - '$replyCount ${replyCount == 1 ? 'Reply' : 'Replies'}', + context.translations.threadSeparatorText(replyCount), textAlign: TextAlign.center, style: _streamTheme.channelTheme.channelHeaderTheme.subtitle, ), @@ -1253,8 +1255,8 @@ class _LoadingIndicator extends StatelessWidget { initialData: false, errorBuilder: (context, error) => Container( color: streamTheme.colorTheme.accentRed.withOpacity(.2), - child: const Center( - child: Text('Error loading messages'), + child: Center( + child: Text(context.translations.loadingMessagesError), ), ), builder: (context, data) { diff --git a/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart b/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart index 0292a05a..f87b8740 100644 --- a/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart @@ -7,6 +7,7 @@ import 'package:stream_chat_flutter/src/stream_chat.dart'; import 'package:stream_chat_flutter/src/user_avatar.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Modal widget for displaying message reactions class MessageReactionsModal extends StatelessWidget { @@ -154,7 +155,7 @@ class MessageReactionsModal extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - 'Message Reactions', + context.translations.messageReactionsText, style: chatThemeData.textTheme.headlineBold, ), const SizedBox(height: 16), diff --git a/packages/stream_chat_flutter/lib/src/message_search_item.dart b/packages/stream_chat_flutter/lib/src/message_search_item.dart index 1f8a31ea..0444d37f 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_item.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_item.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// It shows the current [Message] preview. /// @@ -98,7 +99,7 @@ class MessageSearchItem extends StatelessWidget { Widget _buildSubtitle(BuildContext context, Message message) { var text = message.text; if (message.isDeleted) { - text = 'This message was deleted.'; + text = context.translations.messageDeletedText; } else if (message.attachments.isNotEmpty) { final parts = [ ...message.attachments.map((e) { diff --git a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart index 1a67702f..9d6d36d6 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart @@ -3,6 +3,7 @@ import 'package:stream_chat_flutter/src/info_tile.dart'; import 'package:stream_chat_flutter/src/message_search_item.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Callback called when tapping on a user typedef MessageSearchItemTapCallback = void Function(GetMessageResponse); @@ -140,6 +141,7 @@ class MessageSearchListView extends StatefulWidget { class _MessageSearchListViewState extends State { late final _defaultController = MessageSearchListController(); + MessageSearchListController get _messageSearchListController => widget.messageSearchListController ?? _defaultController; @@ -160,8 +162,8 @@ class _MessageSearchListViewState extends State { constraints: BoxConstraints( minHeight: viewportConstraints.maxHeight, ), - child: const Center( - child: Text('There are no messages currently'), + child: Center( + child: Text(context.translations.emptyMessagesText), ), ), ), @@ -175,7 +177,7 @@ class _MessageSearchListViewState extends State { showMessage: widget.showErrorTile, tileAnchor: Alignment.topCenter, childAnchor: Alignment.topCenter, - message: 'An error occurred.', + message: context.translations.genericErrorText, child: Container(), ); }, @@ -226,10 +228,10 @@ class _MessageSearchListViewState extends State { .colorTheme .accentRed .withOpacity(.2), - child: const Padding( - padding: EdgeInsets.symmetric(vertical: 16), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), child: Center( - child: Text('Error loading messages'), + child: Text(context.translations.loadingMessagesError), ), ), ); @@ -292,7 +294,7 @@ class _MessageSearchListViewState extends State { horizontal: 8, ), child: Text( - '${items.length} results', + context.translations.resultCountText(items.length), style: TextStyle( color: chatThemeData.colorTheme.grey, ), diff --git a/packages/stream_chat_flutter/lib/src/message_text.dart b/packages/stream_chat_flutter/lib/src/message_text.dart index b0bd13ca..6d006085 100644 --- a/packages/stream_chat_flutter/lib/src/message_text.dart +++ b/packages/stream_chat_flutter/lib/src/message_text.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; -import 'package:stream_chat_flutter/src/extension.dart'; /// Text widget to display in message class MessageText extends StatelessWidget { @@ -30,8 +29,6 @@ class MessageText extends StatelessWidget { @override Widget build(BuildContext context) { - final texts = context.translations?.launchUrlError ?? 'defaultValue'; - return Text(texts); final text = _replaceMentions(message.text ?? '').replaceAll('\n', '\n\n'); final themeData = Theme.of(context); diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index 7c95bf0a..03c77a44 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -16,6 +16,7 @@ import 'package:stream_chat_flutter/src/quoted_message_widget.dart'; import 'package:stream_chat_flutter/src/reaction_bubble.dart'; import 'package:stream_chat_flutter/src/url_attachment.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget builder for building attachments typedef AttachmentBuilder = Widget Function( @@ -840,7 +841,7 @@ class _MessageWidgetState extends State ), const SizedBox(width: 8), Text( - 'Only visible to you', + context.translations.onlyVisibleToYouText, style: chatThemeData.textTheme.footnote .copyWith(color: chatThemeData.colorTheme.grey), ), @@ -854,9 +855,9 @@ class _MessageWidgetState extends State final showThreadParticipants = threadParticipants?.isNotEmpty == true; final replyCount = widget.message.replyCount; - var msg = 'Thread Reply'; + var msg = context.translations.threadReplyLabel; if (showThreadReplyIndicator && replyCount! > 1) { - msg = '$replyCount Thread Replies'; + msg = context.translations.threadReplyCountText(replyCount); } // ignore: prefer_function_declarations_over_variables @@ -1201,7 +1202,10 @@ class _MessageWidgetState extends State ); } return Text( - 'Uploading $uploadRemaining/$totalAttachments ...', + context.translations.attachmentsUploadProgressText( + remaining: uploadRemaining, + total: totalAttachments, + ), style: style, ); } @@ -1275,8 +1279,8 @@ class _MessageWidgetState extends State } Widget _buildPinnedMessage(Message message) { - final pinnedBy = message.pinnedBy; - final pinnedByMe = _streamChat.user!.id == pinnedBy!.id; + final pinnedBy = message.pinnedBy!; + final currentUser = _streamChat.user!; return Padding( padding: const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 8), @@ -1290,7 +1294,10 @@ class _MessageWidgetState extends State width: 4, ), Text( - 'Pinned by ${pinnedByMe ? 'You' : pinnedBy.name}', + context.translations.pinnedByUserText( + pinnedBy: pinnedBy, + currentUser: currentUser, + ), style: TextStyle( color: _streamChatTheme.colorTheme.grey, fontSize: 13, diff --git a/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart b/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart deleted file mode 100644 index b1d81fde..00000000 --- a/packages/stream_chat_flutter/lib/src/stream_chat_localizations.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:flutter/widgets.dart'; - -// TODO : Fix localization instructions -// ADDING A NEW STRING -// -// If you (someone contributing to the Stream Chat Flutter) want to add a new -// string to the StreamChatLocalizations object (e.g. because you've added a new -// widget and it has a tooltip), follow these steps: -// -// 1. Add the new getter to StreamChatLocalizations below. -// -// 2. Implement a default value in DefaultMaterialLocalizations below. -// -// 3. Add a test to test/material/localizations_test.dart that verifies that -// this new value is implemented. -// -// 4. Update the flutter_localizations package. To add a new string to the -// flutter_localizations package, you must first add it to the English -// translations (lib/src/l10n/en.json), including a description. -// -// Then you need to add new entries for the string to all of the other -// language locale files by running: -// ``` -// dart dev/tools/localization/bin/gen_missing_localizations.dart -// ``` -// Which will copy the english strings into the other locales as placeholders -// until they can be translated. -// -// Finally you need to re-generate lib/src/l10n/localizations.dart by running: -// ``` -// dart dev/tools/localization/bin/gen_localizations.dart --overwrite -// ``` -// -// There is a README file with further information in the lib/src/l10n/ -// directory. -// -// 5. If you are a Google employee, you should then also follow the instructions -// at go/flutter-l10n. If you're not, don't worry about it. -// -// UPDATING AN EXISTING STRING -// -// If you (someone contributing to the Flutter framework) want to modify an -// existing string in the MaterialLocalizations objects, follow these steps: -// -// 1. Modify the default value of the relevant getter(s) in -// DefaultMaterialLocalizations below. -// -// 2. Update the flutter_localizations package. Modify the out-of-date English -// strings in lib/src/l10n/material_en.arb. -// -// You also need to re-generate lib/src/l10n/localizations.dart by running: -// ``` -// dart dev/tools/localization/bin/gen_localizations.dart --overwrite -// ``` -// -// This script may result in your updated getters being created in newer -// locales and set to the old value of the strings. This is to be expected. -// Leave them as they were generated, and they will be picked up for -// translation. -// -// There is a README file with further information in the lib/src/l10n/ -// directory. -// -// 3. If you are a Google employee, you should then also follow the instructions -// at go/flutter-l10n. If you're not, don't worry about it. - -/// Defines the localized resource values used by the StreamChatFlutter widgets. -/// -/// See also: -/// -/// * [GlobalStreamChatLocalizations], which provides material localizations -/// for many languages. -abstract class StreamChatLocalizations { - /// The `StreamChatLocalizations` from the closest [Localizations] instance - /// that encloses the given context. - /// - /// If no [StreamChatLocalizations] are available in the given `context`, this - /// method returns null. - /// - /// This method is just a convenient shorthand for: - /// `Localizations.of(context, StreamChatLocalizations)`. - /// - /// References to the localized resources defined by this class are typically - /// written in terms of this method. For example: - /// - /// ```dart - /// tooltip: StreamChatLocalizations.of(context).backButtonTooltip, - /// ``` - static StreamChatLocalizations? of(BuildContext context) => - Localizations.of( - context, - StreamChatLocalizations, - ); - - String get launchUrlError; -} diff --git a/packages/stream_chat_flutter/lib/src/thread_header.dart b/packages/stream_chat_flutter/lib/src/thread_header.dart index bfde9a4c..8caf5ada 100644 --- a/packages/stream_chat_flutter/lib/src/thread_header.dart +++ b/packages/stream_chat_flutter/lib/src/thread_header.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/thread_header.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/thread_header_paint.png) @@ -149,7 +150,7 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget { children: [ title ?? Text( - 'Thread Reply', + context.translations.threadReplyLabel, style: chatThemeData.channelTheme.channelHeaderTheme.title, ), const SizedBox(height: 2), diff --git a/packages/stream_chat_flutter/lib/src/typing_indicator.dart b/packages/stream_chat_flutter/lib/src/typing_indicator.dart index 4c0ad19f..48752f07 100644 --- a/packages/stream_chat_flutter/lib/src/typing_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/typing_indicator.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget to show the current list of typing users class TypingIndicator extends StatelessWidget { @@ -63,8 +64,7 @@ class TypingIndicator extends StatelessWidget { height: 4, ), Text( - // ignore: lines_longer_than_80_chars - ' ${data.elementAt(0).name}${data.length == 1 ? '' : ' and ${data.length - 1} more'} ${data.length == 1 ? 'is' : 'are'} typing', + context.translations.userTypingText(data), maxLines: 1, style: style, ), diff --git a/packages/stream_chat_flutter/lib/src/user_item.dart b/packages/stream_chat_flutter/lib/src/user_item.dart index e9d9f7c0..4b42eb6a 100644 --- a/packages/stream_chat_flutter/lib/src/user_item.dart +++ b/packages/stream_chat_flutter/lib/src/user_item.dart @@ -4,6 +4,7 @@ import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/user_list_view.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// /// It shows the current [User] preview. @@ -86,12 +87,13 @@ class UserItem extends StatelessWidget { ); } - Widget _buildLastActive(context) { + Widget _buildLastActive(BuildContext context) { final chatTheme = StreamChatTheme.of(context); return Text( user.online == true - ? 'Online' - : 'Last online ${Jiffy(user.lastActive).fromNow()}', + ? context.translations.userOnlineText + : context.translations.userLastOnlineText + + Jiffy(user.lastActive).fromNow(), style: chatTheme.textTheme.footnote .copyWith(color: chatTheme.colorTheme.black.withOpacity(.5)), ); diff --git a/packages/stream_chat_flutter/lib/src/user_list_view.dart b/packages/stream_chat_flutter/lib/src/user_list_view.dart index f64f3c76..3ad1a337 100644 --- a/packages/stream_chat_flutter/lib/src/user_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/user_list_view.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Callback called when tapping on a user typedef UserTapCallback = void Function(User, Widget?); @@ -155,6 +156,7 @@ class _UserListViewState extends State bool get _isListView => widget.crossAxisCount == 1; late final _defaultController = UserListController(); + UserListController get _userListController => widget.userListController ?? _defaultController; @@ -207,9 +209,9 @@ class _UserListViewState extends State mainAxisAlignment: MainAxisAlignment.center, children: [ Text.rich( - const TextSpan( + TextSpan( children: [ - WidgetSpan( + const WidgetSpan( child: Padding( padding: EdgeInsets.only( right: 2, @@ -217,14 +219,14 @@ class _UserListViewState extends State child: Icon(Icons.error_outline), ), ), - TextSpan(text: 'Error loading users'), + TextSpan(text: context.translations.loadingUsersError), ], ), style: Theme.of(context).textTheme.headline6, ), TextButton( onPressed: () => _userListController.loadData!(), - child: const Text('Retry'), + child: Text(context.translations.retryLabel), ), ], ), @@ -237,8 +239,8 @@ class _UserListViewState extends State constraints: BoxConstraints( minHeight: viewportConstraints.maxHeight, ), - child: const Center( - child: Text('There are no users currently'), + child: Center( + child: Text(context.translations.noUsersLabel), ), ), ), @@ -387,10 +389,10 @@ class _UserListViewState extends State .colorTheme .accentRed .withOpacity(.2), - child: const Padding( - padding: EdgeInsets.symmetric(vertical: 16), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), child: Center( - child: Text('Error loading users'), + child: Text(context.translations.loadingUsersError), ), ), ); diff --git a/packages/stream_chat_flutter/lib/src/utils.dart b/packages/stream_chat_flutter/lib/src/utils.dart index d923b752..e6fda991 100644 --- a/packages/stream_chat_flutter/lib/src/utils.dart +++ b/packages/stream_chat_flutter/lib/src/utils.dart @@ -4,17 +4,15 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Launch URL Future launchURL(BuildContext context, String? url) async { if (url != null && await canLaunch(url)) { await launch(url); } else { - // ignore: deprecated_member_use - Scaffold.of(context).showSnackBar( - const SnackBar( - content: Text('Cannot launch the url'), - ), + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(context.translations.launchUrlError)), ); } } diff --git a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart index 20b2396a..af8e66d7 100644 --- a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart +++ b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart @@ -15,6 +15,7 @@ export 'src/full_screen_media.dart'; export 'src/image_footer.dart'; export 'src/image_header.dart'; export 'src/info_tile.dart'; +export 'src/localization/stream_chat_localizations.dart'; export 'src/mention_tile.dart'; export 'src/message_action.dart'; export 'src/message_input.dart'; @@ -28,7 +29,6 @@ export 'src/reaction_icon.dart'; export 'src/reaction_picker.dart'; export 'src/sending_indicator.dart'; export 'src/stream_chat.dart'; -export 'src/stream_chat_localizations.dart'; export 'src/stream_chat_theme.dart'; export 'src/stream_neumorphic_button.dart'; export 'src/stream_svg_icon.dart'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index bef008fd..4dba5948 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart' - show StreamChatLocalizations; + show StreamChatLocalizations, User; part 'stream_chat_localizations_en.dart'; @@ -113,9 +113,6 @@ abstract class GlobalStreamChatLocalizations GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ]; - - @override - String get launchUrlError; } class _StreamChatLocalizationsDelegate diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 7566be30..66abf0ce 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -8,4 +8,319 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @override String get launchUrlError => 'Cannot launch the url'; + + @override + String get loadingUsersError => 'Error loading users'; + + @override + String get noUsersLabel => 'There are no users currently'; + + @override + String get retryLabel => 'Retry'; + + @override + String get userLastOnlineText => 'Last online'; + + @override + String get userOnlineText => 'Online'; + + @override + String userTypingText(Iterable users) { + if (users.isEmpty) return ''; + final first = users.first; + if (users.length == 1) { + return '${first.name} is typing'; + } + return '${first.name} and ${users.length - 1} more are typing'; + } + + @override + String get threadReplyLabel => 'Thread Reply'; + + @override + String get onlyVisibleToYouText => 'Only visible to you'; + + @override + String threadReplyCountText(int count) => '$count Thread Replies'; + + @override + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }) => + 'Uploading $remaining/$total ...'; + + @override + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }) { + final pinnedByCurrentUser = currentUser.id == pinnedBy.id; + if (pinnedByCurrentUser) return 'Pinned by You'; + return 'Pinned by ${pinnedBy.name}'; + } + + @override + String get emptyMessagesText => 'There are no messages currently'; + + @override + String get genericErrorText => 'Something went wrong'; + + @override + String get loadingMessagesError => 'Error loading messages'; + + @override + String resultCountText(int count) => '$count results'; + + @override + String get messageDeletedText => 'This message was deleted.'; + + @override + String get messageDeletedLabel => 'Message deleted'; + + @override + String get messageReactionsText => 'Message Reactions'; + + @override + String get emptyChatMessagesText => 'No chats here yet...'; + + @override + String threadSeparatorText(int replyCount) { + if (replyCount == 1) return '1 Reply'; + return '$replyCount Replies'; + } + + @override + String get connectedLabel => 'Connected'; + + @override + String get disconnectedLabel => 'Disconnected'; + + @override + String get reconnectingLabel => 'Reconnecting...'; + + @override + String get alsoSendAsDirectMessageLabel => 'Also send as direct message'; + + @override + String get addACommentOrSendLabel => 'Add a comment or send'; + + @override + String get searchGifLabel => 'Search GIFs'; + + @override + String get writeAMessageLabel => 'Write a message'; + + @override + String get instantCommandsLabel => 'Instant Commands'; + + @override + String get fileTooLargeAfterCompressionError => + 'The file is too large to upload. ' + 'The file size limit is 20MB. ' + 'We tried compressing it, but it was not enough.'; + + @override + String get fileTooLargeError => + 'The file is too large to upload. The file size limit is 20MB.'; + + @override + String emojiMatchingQueryText(String query) => 'Emoji matching "$query"'; + + @override + String get addAFileLabel => 'Add a file'; + + @override + String get photoFromCameraLabel => 'Photo from camera'; + + @override + String get uploadAFileLabel => 'Upload a file'; + + @override + String get uploadAPhotoLabel => 'Upload a photo'; + + @override + String get uploadAVideoLabel => 'Upload a video'; + + @override + String get videoFromCameraLabel => 'Video from camera'; + + @override + String get okLabel => 'OK'; + + @override + String get somethingWentWrongLabel => 'Something went wrong'; + + @override + String get addMoreFilesLabel => 'Add more files'; + + @override + String get enablePhotoAndVideoAccessMessage => + 'Please enable access to your photos' + '\nand videos so you can share them with friends.'; + + @override + String get allowGalleryAccessMessage => 'Allow access to your gallery'; + + @override + String get flagMessageLabel => 'Flag Message'; + + @override + String get flagMessageQuestion => + 'Do you want to send a copy of this message to a' + '\nmoderator for further investigation?'; + + @override + String get flagLabel => 'FLAG'; + + @override + String get cancelLabel => 'CANCEL'; + + @override + String get flagMessageSuccessfulLabel => 'Message flagged'; + + @override + String get flagMessageSuccessfulText => + 'The message has been reported to a moderator.'; + + @override + String get deleteLabel => 'DELETE'; + + @override + String get deleteMessageLabel => 'Delete Message'; + + @override + String get deleteMessageQuestion => + 'Are you sure you want to permanently delete this\nmessage?'; + + @override + String get operationCouldNotBeCompletedText => + 'The operation couldn\'t be completed.'; + + @override + String get replyLabel => 'Reply'; + + @override + String togglePinUnpinText({required bool pinned}) { + if (pinned) return 'Unpin from Conversation'; + return 'Pin to Conversation'; + } + + @override + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}) { + if (isDeleteFailed) return 'Retry Deleting Message'; + return 'Delete Message'; + } + + @override + String get copyMessageLabel => 'Copy Message'; + + @override + String get editMessageLabel => 'Edit Message'; + + @override + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}) { + if (isUpdateFailed) return 'Resend Edited Message'; + return 'Resend'; + } + + @override + String get photosLabel => 'Photos'; + + @override + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent $date at $time'; + + @override + String get todayLabel => 'Today'; + + @override + String get yesterdayLabel => 'Yesterday'; + + @override + String get channelIsMutedText => ' Channel is muted'; + + @override + String get noTitleText => 'No title'; + + @override + String get letsStartChattingLabel => 'Let’s start chatting!'; + + @override + String get sendingFirstMessageLabel => + 'How about sending your first message to a friend?'; + + @override + String get startAChatLabel => 'Start a chat'; + + @override + String get loadingChannelsError => 'Error loading channels'; + + @override + String get deleteConversationLabel => 'Delete Conversation'; + + @override + String get deleteConversationQuestion => + 'Are you sure you want to delete this conversation?'; + + @override + String get streamChatLabel => 'Stream Chat'; + + @override + String get searchingForNetworkLabel => 'Searching for Network'; + + @override + String get offlineLabel => 'Offline...'; + + @override + String get tryAgainLabel => 'Try Again'; + + @override + String membersCountText(int count) { + if (count == 1) return '1 Member'; + return '$count Members'; + } + + @override + String watchersCountText(int count) { + if (count == 1) return '1 Online'; + return '$count Online'; + } + + @override + String get viewInfoLabel => 'View Info'; + + @override + String get leaveGroupLabel => 'Leave Group'; + + @override + String get leaveLabel => 'LEAVE'; + + @override + String get leaveConversationLabel => 'Leave conversation'; + + @override + String get leaveConversationQuestion => + 'Are you sure you want to leave this conversation?'; + + @override + String get showInChatLabel => 'Show in Chat'; + + @override + String get saveImageLabel => 'Save Image'; + + @override + String get saveVideoLabel => 'Save Video'; + + @override + String get uploadErrorLabel => 'UPLOAD ERROR'; + + @override + String get giphyLabel => 'Giphy'; + + @override + String get shuffleLabel => 'Shuffle'; + + @override + String get sendLabel => 'Send'; } From 67a36d9c35a34b7ca07460cc2cc04ec37eff8117 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 19 Jul 2021 16:51:49 +0530 Subject: [PATCH 05/35] chore: add remaining translations Signed-off-by: xsahil03x --- .../stream_chat_flutter/example/lib/main.dart | 44 +++---------------- .../lib/src/attachment/file_attachment.dart | 2 +- .../lib/src/full_screen_media.dart | 2 +- .../lib/src/gallery_footer.dart | 4 +- .../lib/src/gallery_header.dart | 4 +- .../lib/src/localization/translations.dart | 25 +++++++++++ .../lib/src/message_input.dart | 4 +- .../lib/src/message_search_item.dart | 6 ++- .../lib/src/message_text.dart | 11 ++--- .../lib/src/system_message.dart | 4 +- .../lib/src/thread_header.dart | 2 +- .../lib/src/stream_chat_localizations_en.dart | 15 +++++++ 12 files changed, 65 insertions(+), 58 deletions(-) diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index 91d44176..de2433ab 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -5,32 +5,6 @@ import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_localizations/stream_chat_localizations.dart'; -/// A custom set of localizations for the 'hi' locale. -class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { - const StreamChatLocalizationsHi() : super(localeName: 'hi'); - - static const LocalizationsDelegate delegate = - _HindiStreamChatLocalizationsDelegate(); - - @override - String get launchUrlError => 'URL लॉन्च नहीं कर सकता'; -} - -class _HindiStreamChatLocalizationsDelegate - extends LocalizationsDelegate { - const _HindiStreamChatLocalizationsDelegate(); - - @override - bool isSupported(Locale locale) => locale.languageCode == 'hi'; - - @override - Future load(Locale locale) => - SynchronousFuture(const StreamChatLocalizationsHi()); - - @override - bool shouldReload(_HindiStreamChatLocalizationsDelegate old) => false; -} - void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -96,18 +70,12 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) => MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), - themeMode: ThemeMode.system, - supportedLocales: [ - Locale('en', 'US'), - Locale('hi', 'IN'), - ], - localizationsDelegates: [ - GlobalStreamChatLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - StreamChatLocalizationsHi.delegate, - ], + localizationsDelegates: const [ + GlobalStreamChatLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], builder: (context, widget) => StreamChat( client: client, child: widget, diff --git a/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart index 7377ba20..f57e1ee6 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart @@ -76,7 +76,7 @@ class FileAttachment extends AttachmentWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - attachment.title ?? 'File', + attachment.title ?? context.translations.fileText, style: StreamChatTheme.of(context).textTheme.bodyBold, maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/packages/stream_chat_flutter/lib/src/full_screen_media.dart b/packages/stream_chat_flutter/lib/src/full_screen_media.dart index 287612ad..13ec3b3b 100644 --- a/packages/stream_chat_flutter/lib/src/full_screen_media.dart +++ b/packages/stream_chat_flutter/lib/src/full_screen_media.dart @@ -200,7 +200,7 @@ class _FullScreenMediaState extends State ); }, ), - if (widget.message.type != 'ephemeral') + if (!widget.message.isEphemeral) GalleryFooter( currentPage: _currentPage, totalPages: widget.mediaAttachments.length, diff --git a/packages/stream_chat_flutter/lib/src/gallery_footer.dart b/packages/stream_chat_flutter/lib/src/gallery_footer.dart index ed8c39f9..03d575ae 100644 --- a/packages/stream_chat_flutter/lib/src/gallery_footer.dart +++ b/packages/stream_chat_flutter/lib/src/gallery_footer.dart @@ -136,7 +136,9 @@ class _GalleryFooterState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - '${widget.currentPage + 1} of ${widget.totalPages}', + '${widget.currentPage + 1} ' + '${context.translations.ofText} ' + '${widget.totalPages}', style: galleryFooterThemeData.titleTextStyle, ), ], diff --git a/packages/stream_chat_flutter/lib/src/gallery_header.dart b/packages/stream_chat_flutter/lib/src/gallery_header.dart index 6c4ecfee..e0852800 100644 --- a/packages/stream_chat_flutter/lib/src/gallery_header.dart +++ b/packages/stream_chat_flutter/lib/src/gallery_header.dart @@ -67,7 +67,7 @@ class GalleryHeader extends StatelessWidget implements PreferredSizeWidget { : const SizedBox(), backgroundColor: galleryHeaderThemeData.backgroundColor, actions: [ - if (message.type != 'ephemeral') + if (!message.isEphemeral) IconButton( icon: StreamSvgIcon.iconMenuPoint( color: galleryHeaderThemeData.iconMenuPointColor, @@ -78,7 +78,7 @@ class GalleryHeader extends StatelessWidget implements PreferredSizeWidget { ), ], centerTitle: true, - title: message.type != 'ephemeral' + title: !message.isEphemeral ? InkWell( onTap: onTitleTap, child: SizedBox( diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 651f97f8..9b270bd5 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -190,6 +190,16 @@ abstract class Translations { String get shuffleLabel; String get sendLabel; + + String get withText; + + String get inText; + + String get youText; + + String get ofText; + + String get fileText; } class DefaultTranslations implements Translations { @@ -514,4 +524,19 @@ class DefaultTranslations implements Translations { @override String get sendLabel => 'Send'; + + @override + String get withText => 'with'; + + @override + String get inText => 'in'; + + @override + String get youText => 'You'; + + @override + String get ofText => 'of'; + + @override + String get fileText => 'File'; } diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 702cfe4e..456357ce 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -2254,10 +2254,10 @@ class _PickerWidget extends StatefulWidget { final StreamChatThemeData streamChatTheme; @override - __PickerWidgetState createState() => __PickerWidgetState(); + _PickerWidgetState createState() => _PickerWidgetState(); } -class __PickerWidgetState extends State<_PickerWidget> { +class _PickerWidgetState extends State<_PickerWidget> { Future? requestPermission; @override diff --git a/packages/stream_chat_flutter/lib/src/message_search_item.dart b/packages/stream_chat_flutter/lib/src/message_search_item.dart index 0444d37f..de6c5e75 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_item.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_item.dart @@ -50,12 +50,14 @@ class MessageSearchItem extends StatelessWidget { title: Row( children: [ Text( - user.id == StreamChat.of(context).user?.id ? 'You' : user.name, + user.id == StreamChat.of(context).user?.id + ? context.translations.youText + : user.name, style: chatThemeData.channelPreviewTheme.title, ), if (channelName != null) ...[ Text( - ' in ', + ' ${context.translations.inText} ', style: chatThemeData.channelPreviewTheme.title?.copyWith( fontWeight: FontWeight.normal, ), diff --git a/packages/stream_chat_flutter/lib/src/message_text.dart b/packages/stream_chat_flutter/lib/src/message_text.dart index 6d006085..8fcf331c 100644 --- a/packages/stream_chat_flutter/lib/src/message_text.dart +++ b/packages/stream_chat_flutter/lib/src/message_text.dart @@ -43,15 +43,10 @@ class MessageText extends StatelessWidget { final mentionedUser = message.mentionedUsers.firstWhereOrNull( (u) => '@${u.name}' == link, ); - if (mentionedUser == null) { - return; - } - if (onMentionTap != null) { - onMentionTap!(mentionedUser); - } else { - print('tap on ${mentionedUser.name}'); - } + if (mentionedUser == null) return; + + onMentionTap?.call(mentionedUser); } else { if (onLinkTap != null) { onLinkTap!(link); diff --git a/packages/stream_chat_flutter/lib/src/system_message.dart b/packages/stream_chat_flutter/lib/src/system_message.dart index 11c80300..297810b3 100644 --- a/packages/stream_chat_flutter/lib/src/system_message.dart +++ b/packages/stream_chat_flutter/lib/src/system_message.dart @@ -13,8 +13,8 @@ class SystemMessage extends StatelessWidget { /// This message final Message message; - // ignore: lines_longer_than_80_chars - /// The function called when tapping on the message when the message is not failed + /// The function called when tapping on the message + /// when the message is not failed final void Function(Message)? onMessageTap; @override diff --git a/packages/stream_chat_flutter/lib/src/thread_header.dart b/packages/stream_chat_flutter/lib/src/thread_header.dart index 8caf5ada..a5eb62db 100644 --- a/packages/stream_chat_flutter/lib/src/thread_header.dart +++ b/packages/stream_chat_flutter/lib/src/thread_header.dart @@ -112,7 +112,7 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'with ', + '${context.translations.withText} ', style: chatThemeData.channelTheme.channelHeaderTheme.subtitle, ), Flexible( diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 66abf0ce..91f41b64 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -323,4 +323,19 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @override String get sendLabel => 'Send'; + + @override + String get withText => 'with'; + + @override + String get inText => 'in'; + + @override + String get youText => 'You'; + + @override + String get ofText => 'of'; + + @override + String get fileText => 'File'; } From 297092802dd8a34044be769fba1f30ba73488115 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 19 Jul 2021 16:56:08 +0530 Subject: [PATCH 06/35] chore: flutter format Signed-off-by: xsahil03x --- .../lib/src/channel_list_view.dart | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/channel_list_view.dart b/packages/stream_chat_flutter/lib/src/channel_list_view.dart index 5ef8d706..0977f662 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_view.dart @@ -548,19 +548,18 @@ class _ChannelListViewState extends State { color: backgroundColor, iconWidget: StreamSvgIcon.delete( color: chatThemeData.colorTheme.accentError, - ), - onTap: widget.onDeletePressed != null - ? () { - widget.onDeletePressed!(channel); - } - : () async { - final res = await showConfirmationDialog( - context, - title: - context.translations.deleteConversationLabel, - question: context - .translations.deleteConversationQuestion, - okText: context.translations.deleteLabel, + ), + onTap: widget.onDeletePressed != null + ? () { + widget.onDeletePressed?.call(channel); + } + : () async { + final res = await showConfirmationDialog( + context, + title: context.translations.deleteConversationLabel, + question: + context.translations.deleteConversationQuestion, + okText: context.translations.deleteLabel, cancelText: context.translations.cancelLabel, icon: StreamSvgIcon.delete( color: chatThemeData.colorTheme.accentError, From 5f7b3ffae85119619adb7b36717334521c3f15c7 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 19 Jul 2021 17:42:36 +0530 Subject: [PATCH 07/35] test: fix tests Signed-off-by: xsahil03x --- .../stream_chat_flutter/lib/src/attachment_actions_modal.dart | 2 +- packages/stream_chat_flutter/lib/src/extension.dart | 3 ++- .../stream_chat_flutter/lib/src/message_actions_modal.dart | 4 ++-- packages/stream_chat_flutter/lib/src/message_input.dart | 1 - packages/stream_chat_flutter/lib/src/message_list_view.dart | 1 - packages/stream_chat_flutter/lib/src/message_widget.dart | 1 - .../test/src/attachment_actions_modal_test.dart | 1 + .../test/src/message_action_modal_test.dart | 4 ++-- 8 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart index 0c224d20..9b64cce7 100644 --- a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart @@ -142,7 +142,7 @@ class AttachmentActionsModal extends StatelessWidget { if (StreamChat.of(context).user?.id == message.user?.id) _buildButton( context, - context.translations.deleteLabel, + context.translations.deleteLabel.capitalize(), StreamSvgIcon.delete( size: 24, color: theme.colorTheme.accentError, diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index b185ae3b..5d67ee50 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -10,7 +10,8 @@ final _emojiChars = Emoji.chars(); /// String extension extension StringExtension on String { /// Returns the capitalized string - String capitalize() => '${this[0].toUpperCase()}${substring(1)}'; + String capitalize() => + '${this[0].toUpperCase()}${substring(1).toLowerCase()}'; /// Returns whether the string contains only emoji's or not. /// diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart index 2f37d637..3e0afe75 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart @@ -274,7 +274,7 @@ class _MessageActionsModalState extends State { size: 24, ), question: context.translations.flagMessageQuestion, - okText: context.translations.okLabel, + okText: context.translations.flagLabel, cancelText: context.translations.cancelLabel, ); @@ -594,7 +594,7 @@ class _MessageActionsModalState extends State { ), Text( context.translations.editMessageLabel, - style: TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), IconButton( visualDensity: VisualDensity.compact, diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 456357ce..e5e6ca48 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -24,7 +24,6 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:substring_highlight/substring_highlight.dart'; import 'package:video_compress/video_compress.dart'; -import 'package:stream_chat_flutter/src/extension.dart'; export 'package:video_compress/video_compress.dart' show VideoQuality; diff --git a/packages/stream_chat_flutter/lib/src/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view.dart index 2c250eaa..ac124b46 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view.dart @@ -17,7 +17,6 @@ import 'package:stream_chat_flutter/src/system_message.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:visibility_detector/visibility_detector.dart'; -import 'package:stream_chat_flutter/src/extension.dart'; /// Widget builder for message /// [defaultMessageWidget] is the default [MessageWidget] configuration diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index 32e4794b..44038282 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -16,7 +16,6 @@ import 'package:stream_chat_flutter/src/quoted_message_widget.dart'; import 'package:stream_chat_flutter/src/reaction_bubble.dart'; import 'package:stream_chat_flutter/src/url_attachment.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -import 'package:stream_chat_flutter/src/extension.dart'; /// Widget builder for building attachments typedef AttachmentBuilder = Widget Function( diff --git a/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart b/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart index 3f210742..59a49ac7 100644 --- a/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart +++ b/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart @@ -7,6 +7,7 @@ import 'package:stream_chat_flutter/src/attachment_actions_modal.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'mocks.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; class MockAttachmentDownloader extends Mock { ProgressCallback? progressCallback; diff --git a/packages/stream_chat_flutter/test/src/message_action_modal_test.dart b/packages/stream_chat_flutter/test/src/message_action_modal_test.dart index 953434de..3aec707b 100644 --- a/packages/stream_chat_flutter/test/src/message_action_modal_test.dart +++ b/packages/stream_chat_flutter/test/src/message_action_modal_test.dart @@ -717,7 +717,7 @@ void main() { await tester.tap(find.text('Delete Message')); await tester.pumpAndSettle(); - expect(find.text('Delete message'), findsOneWidget); + expect(find.text('Delete Message'), findsOneWidget); await tester.tap(find.text('DELETE')); await tester.pumpAndSettle(); @@ -773,7 +773,7 @@ void main() { await tester.tap(find.text('Delete Message')); await tester.pumpAndSettle(); - expect(find.text('Delete message'), findsOneWidget); + expect(find.text('Delete Message'), findsOneWidget); await tester.tap(find.text('DELETE')); await tester.pumpAndSettle(); From 2b36f009c2eb43e18b473270d7345b10cf8d02c4 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 20 Jul 2021 18:09:12 +0530 Subject: [PATCH 08/35] chore: minor fixes, add support for "hi" locale Signed-off-by: xsahil03x --- .../stream_chat_flutter/example/lib/main.dart | 4 + .../lib/src/channel_info.dart | 4 +- .../lib/src/channel_preview.dart | 2 +- .../lib/src/full_screen_media.dart | 18 - .../lib/src/localization/translations.dart | 25 +- .../lib/src/user_item.dart | 4 +- .../lib/stream_chat_flutter.dart | 2 + .../lib/src/stream_chat_localizations.dart | 7 +- .../lib/src/stream_chat_localizations_en.dart | 19 +- .../lib/src/stream_chat_localizations_hi.dart | 353 ++++++++++++++++++ 10 files changed, 403 insertions(+), 35 deletions(-) create mode 100644 packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index de2433ab..d643dfea 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -70,6 +70,10 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) => MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), + supportedLocales: const [ + Locale('en'), + Locale('hi'), + ], localizationsDelegates: const [ GlobalStreamChatLocalizations.delegate, GlobalCupertinoLocalizations.delegate, diff --git a/packages/stream_chat_flutter/lib/src/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel_info.dart index e9c2b7c9..4e860745 100644 --- a/packages/stream_chat_flutter/lib/src/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel_info.dart @@ -84,8 +84,8 @@ class ChannelInfo extends StatelessWidget { ); } else { alternativeWidget = Text( - context.translations.userLastOnlineText + - Jiffy(otherMember.user?.lastActive).fromNow(), + '${context.translations.userLastOnlineText} ' + '${Jiffy(otherMember.user?.lastActive).fromNow()}', style: textStyle, ); } diff --git a/packages/stream_chat_flutter/lib/src/channel_preview.dart b/packages/stream_chat_flutter/lib/src/channel_preview.dart index 432f3354..4c0d2b42 100644 --- a/packages/stream_chat_flutter/lib/src/channel_preview.dart +++ b/packages/stream_chat_flutter/lib/src/channel_preview.dart @@ -198,7 +198,7 @@ class ChannelPreview extends StatelessWidget { size: 16, ), Text( - context.translations.channelIsMutedText, + ' ${context.translations.channelIsMutedText}', style: chatThemeData.channelPreviewTheme.subtitle, ), ], diff --git a/packages/stream_chat_flutter/lib/src/full_screen_media.dart b/packages/stream_chat_flutter/lib/src/full_screen_media.dart index 13ec3b3b..5e498a32 100644 --- a/packages/stream_chat_flutter/lib/src/full_screen_media.dart +++ b/packages/stream_chat_flutter/lib/src/full_screen_media.dart @@ -4,7 +4,6 @@ import 'dart:io'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:chewie/chewie.dart'; import 'package:flutter/material.dart'; -import 'package:jiffy/jiffy.dart'; import 'package:photo_view/photo_view.dart'; import 'package:stream_chat_flutter/src/gallery_footer.dart'; import 'package:stream_chat_flutter/src/gallery_header.dart'; @@ -183,7 +182,6 @@ class _FullScreenMediaState extends State children: [ GalleryHeader( userName: widget.userName, - // TODO: Fix this sentAt: context.translations.sentAtText( date: widget.message.createdAt, time: widget.message.createdAt, @@ -225,22 +223,6 @@ class _FullScreenMediaState extends State ), ); - String getDay(DateTime dateTime) { - final now = DateTime.now(); - - if (DateTime(dateTime.year, dateTime.month, dateTime.day) == - DateTime(now.year, now.month, now.day)) { - return 'today'; - } else if (DateTime(now.year, now.month, now.day) - .difference(dateTime) - .inHours < - 24) { - return 'yesterday'; - } else { - return 'on ${Jiffy(dateTime).MMMd}'; - } - } - @override void dispose() async { for (final package in videoPackages.values) { diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 9b270bd5..4344dc8a 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -1,3 +1,4 @@ +import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart' show User; @@ -146,11 +147,6 @@ abstract class Translations { String get loadingChannelsError; - // title: 'Delete Conversation', -// okText: 'DELETE', -// question: -// 'Are you sure you want to delete this conversation?', - String get deleteConversationLabel; String get deleteConversationQuestion; @@ -274,7 +270,7 @@ class DefaultTranslations implements Translations { String resultCountText(int count) => '$count results'; @override - String get messageDeletedText => 'This message was deleted.'; + String get messageDeletedText => 'This message is deleted.'; @override String get messageDeletedLabel => 'Message deleted'; @@ -428,9 +424,22 @@ class DefaultTranslations implements Translations { @override String get photosLabel => 'Photos'; + String _getDay(DateTime dateTime) { + final now = Jiffy(DateTime.now()); + final date = Jiffy(dateTime); + + if (date.isSame(now, Units.DAY)) { + return 'today'; + } else if (now.diff(date, Units.HOUR) < 24) { + return 'yesterday'; + } else { + return 'on ${date.MMMd}'; + } + } + @override String sentAtText({required DateTime date, required DateTime time}) => - 'Sent $date at $time'; + 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'Today'; @@ -439,7 +448,7 @@ class DefaultTranslations implements Translations { String get yesterdayLabel => 'Yesterday'; @override - String get channelIsMutedText => ' Channel is muted'; + String get channelIsMutedText => 'Channel is muted'; @override String get noTitleText => 'No title'; diff --git a/packages/stream_chat_flutter/lib/src/user_item.dart b/packages/stream_chat_flutter/lib/src/user_item.dart index 99b35df1..a55693aa 100644 --- a/packages/stream_chat_flutter/lib/src/user_item.dart +++ b/packages/stream_chat_flutter/lib/src/user_item.dart @@ -92,8 +92,8 @@ class UserItem extends StatelessWidget { return Text( user.online == true ? context.translations.userOnlineText - : context.translations.userLastOnlineText + - Jiffy(user.lastActive).fromNow(), + : '${context.translations.userLastOnlineText} ' + '${Jiffy(user.lastActive).fromNow()}', style: chatTheme.textTheme.footnote.copyWith( color: chatTheme.colorTheme.textHighEmphasis.withOpacity(.5)), ); diff --git a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart index 4b4fd9eb..eb690a9b 100644 --- a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart +++ b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart @@ -1,3 +1,4 @@ +export 'package:jiffy/jiffy.dart'; export 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; export 'src/attachment/attachment.dart'; @@ -16,6 +17,7 @@ export 'src/gallery_footer.dart'; export 'src/gallery_header.dart'; export 'src/info_tile.dart'; export 'src/localization/stream_chat_localizations.dart'; +export 'src/localization/translations.dart' show DefaultTranslations; export 'src/mention_tile.dart'; export 'src/message_action.dart'; export 'src/message_input.dart'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index 4dba5948..82662134 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -1,11 +1,14 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart' show StreamChatLocalizations, User; part 'stream_chat_localizations_en.dart'; +part 'stream_chat_localizations_hi.dart'; + /// The set of supported languages, as language code strings. /// /// The [GlobalStreamChatLocalizations.delegate] can generate localizations for @@ -14,7 +17,7 @@ part 'stream_chat_localizations_en.dart'; /// See also: /// /// * [getStreamChatTranslation], whose documentation describes these values. -const kStreamChatSupportedLanguages = {'en'}; +const kStreamChatSupportedLanguages = {'en', 'hi'}; /// Creates a [GlobalStreamChatLocalizations] instance for the given `locale`. /// @@ -38,6 +41,8 @@ GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) { switch (locale.languageCode) { case 'en': return const StreamChatLocalizationsEn(); + case 'hi': + return const StreamChatLocalizationsHi(); } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 91f41b64..88b88840 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -73,7 +73,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String resultCountText(int count) => '$count results'; @override - String get messageDeletedText => 'This message was deleted.'; + String get messageDeletedText => 'This message is deleted.'; @override String get messageDeletedLabel => 'Message deleted'; @@ -227,9 +227,22 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @override String get photosLabel => 'Photos'; + String _getDay(DateTime dateTime) { + final now = Jiffy(DateTime.now()); + final date = Jiffy(dateTime); + + if (date.isSame(now, Units.DAY)) { + return 'today'; + } else if (now.diff(date, Units.HOUR) < 24) { + return 'yesterday'; + } else { + return 'on ${date.MMMd}'; + } + } + @override String sentAtText({required DateTime date, required DateTime time}) => - 'Sent $date at $time'; + 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'Today'; @@ -238,7 +251,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get yesterdayLabel => 'Yesterday'; @override - String get channelIsMutedText => ' Channel is muted'; + String get channelIsMutedText => 'Channel is muted'; @override String get noTitleText => 'No title'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart new file mode 100644 index 00000000..5666b77d --- /dev/null +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -0,0 +1,353 @@ +part of 'stream_chat_localizations.dart'; + +/// The translations for English (`hi`). +class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { + /// Create an instance of the translation bundle for Hindi. + const StreamChatLocalizationsHi({String localeName = 'hi'}) + : super(localeName: localeName); + + @override + String get launchUrlError => 'यूआरएल लॉन्च नहीं कर सकते'; + + @override + String get loadingUsersError => 'यूजर लोड करने में समस्या'; + + @override + String get noUsersLabel => 'वर्तमान में कोई यूजर नहीं हैं'; + + @override + String get retryLabel => 'पुन: प्रयास करे'; + + @override + String get userLastOnlineText => 'अंतिम ऑनलाइन'; + + @override + String get userOnlineText => 'ऑनलाइन'; + + @override + String userTypingText(Iterable users) { + if (users.isEmpty) return ''; + final first = users.first; + if (users.length == 1) { + return '${first.name} टाइप कर रहा है'; + } + return '${first.name} और ${users.length - 1} और टाइप कर रहे हैं'; + } + + @override + String get threadReplyLabel => 'थ्रेड जवाब'; + + @override + String get onlyVisibleToYouText => 'केवल आपको दिखाई दे रहा है'; + + @override + String threadReplyCountText(int count) => '$count थ्रेड जवाब'; + + @override + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }) => + 'अपलोडिंग $remaining/$total ...'; + + @override + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }) { + final pinnedByCurrentUser = currentUser.id == pinnedBy.id; + if (pinnedByCurrentUser) return 'आपके द्वारा पिन किया गया'; + return '${pinnedBy.name} द्वारा पिन किया गया'; + } + + @override + String get emptyMessagesText => 'वर्तमान में कोई संदेश नहीं है'; + + @override + String get genericErrorText => 'कुछ समस्या हो गई'; + + @override + String get loadingMessagesError => 'संदेश लोड करने में समस्या'; + + @override + String resultCountText(int count) => '$count परिणाम'; + + @override + String get messageDeletedText => 'यह संदेश हटा दिया गया है।'; + + @override + String get messageDeletedLabel => 'संदेश हटाये'; + + @override + String get messageReactionsText => 'संदेश प्रतिक्रियाएं'; + + @override + String get emptyChatMessagesText => 'यहां अभी तक कोई चैट नहीं...'; + + @override + String threadSeparatorText(int replyCount) { + if (replyCount == 1) return '1 जवाब'; + return '$replyCount जवाब'; + } + + @override + String get connectedLabel => 'कनेक्टेड'; + + @override + String get disconnectedLabel => 'डिस्कनेक्टेड'; + + @override + String get reconnectingLabel => 'पुनः कनेक्टिंग...'; + + @override + String get alsoSendAsDirectMessageLabel => 'सीधे संदेश के रूप में भी भेजें'; + + @override + String get addACommentOrSendLabel => 'एक टिप्पणी जोड़ें या भेजें'; + + @override + String get searchGifLabel => 'जीआईएफ खोजें'; + + @override + String get writeAMessageLabel => 'एक सन्देश लिखिए'; + + @override + String get instantCommandsLabel => 'तत्काल आदेश'; + + @override + String get fileTooLargeAfterCompressionError => + 'फ़ाइल अपलोड करने के लिए बहुत बड़ी है। ' + 'फ़ाइल आकार सीमा 20MB है। ' + 'हमने इसे कंप्रेस करने की कोशिश की, लेकिन यह काफी नहीं था।'; + + @override + String get fileTooLargeError => + 'फ़ाइल अपलोड करने के लिए बहुत बड़ी है। फ़ाइल आकार सीमा 20MB है।'; + + @override + String emojiMatchingQueryText(String query) => '"$query" से मिलते हुए इमोजी'; + + @override + String get addAFileLabel => 'एक फ़ाइल जोड़ें'; + + @override + String get photoFromCameraLabel => 'कैमरे से फोटो'; + + @override + String get uploadAFileLabel => 'एक फाइल अपलोड करें'; + + @override + String get uploadAPhotoLabel => 'एक फोटो अपलोड करो'; + + @override + String get uploadAVideoLabel => 'एक वीडियो अपलोड करें'; + + @override + String get videoFromCameraLabel => 'कैमरे से वीडियो'; + + @override + String get okLabel => 'ठीक'; + + @override + String get somethingWentWrongLabel => 'लोड करने में समस्या'; + + @override + String get addMoreFilesLabel => 'और फ़ाइलें जोड़ें'; + + @override + String get enablePhotoAndVideoAccessMessage => + 'कृपया अपने फ़ोटो और वीडियो तक पहुंच सक्षम करें' + '\nताकि आप उन्हें मित्रों के साथ साझा कर सकें।'; + + @override + String get allowGalleryAccessMessage => 'अपनी गैलरी तक पहुंच की अनुमति दें'; + + @override + String get flagMessageLabel => 'फ्लैग संदेश'; + + @override + String get flagMessageQuestion => 'क्या आप आगे की जांच के लिए इस संदेश की' + '\nएक प्रति मॉडरेटर को भेजना चाहते हैं?'; + + @override + String get flagLabel => 'फ्लैग'; + + @override + String get cancelLabel => 'रद्द करें'; + + @override + String get flagMessageSuccessfulLabel => 'संदेश फ्लैग हो गया'; + + @override + String get flagMessageSuccessfulText => + 'संदेश की रिपोर्ट एक मॉडरेटर को कर दी गई है।'; + + @override + String get deleteLabel => 'हटाएँ'; + + @override + String get deleteMessageLabel => 'संदेश हटाएं'; + + @override + String get deleteMessageQuestion => + 'क्या आप वाकई इस संदेश को स्थायी रूप से\nहटाना चाहते हैं?'; + + @override + String get operationCouldNotBeCompletedText => + 'कार्रवाई पूरी नहीं की जा सकी.'; + + @override + String get replyLabel => 'रिप्लाई'; + + @override + String togglePinUnpinText({required bool pinned}) { + if (pinned) return 'बातचीत से अनपिन करें'; + return 'बातचीत में पिन करें'; + } + + @override + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}) { + if (isDeleteFailed) return 'संदेश हटाने का पुनः प्रयास करें'; + return 'संदेश को हटाएं'; + } + + @override + String get copyMessageLabel => 'संदेश कॉपी करें'; + + @override + String get editMessageLabel => 'संदेश एडिट करें'; + + @override + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}) { + if (isUpdateFailed) return 'एडिट संदेश फिर से भेजें'; + return 'पुन: भेजें'; + } + + @override + String get photosLabel => 'तस्वीरें'; + + String _getDay(DateTime dateTime) { + final now = Jiffy(DateTime.now()); + final date = Jiffy(dateTime); + + if (date.isSame(now, Units.DAY)) { + return 'आज'; + } else if (now.diff(date, Units.HOUR) < 24) { + return 'कल'; + } else { + return '${date.MMMd} को'; + } + } + + @override + String sentAtText({required DateTime date, required DateTime time}) => + '${_getDay(date)} ${Jiffy(time.toLocal()).format('HH:mm')} बजे भेजा गया'; + + @override + String get todayLabel => 'आज'; + + @override + String get yesterdayLabel => 'बिता हुआ कल'; + + @override + String get channelIsMutedText => 'चैनल मौन है'; + + @override + String get noTitleText => 'कोई शीर्षक नहीं'; + + @override + String get letsStartChattingLabel => 'चलो चैट करना शुरू करें!'; + + @override + String get sendingFirstMessageLabel => + 'किसी मित्र को अपना पहला संदेश भेजने के बारे में क्या विचार है?'; + + @override + String get startAChatLabel => 'चैट शुरू करें'; + + @override + String get loadingChannelsError => 'चैनल लोड करने में समस्या'; + + @override + String get deleteConversationLabel => 'वार्तालाप हटाए'; + + @override + String get deleteConversationQuestion => + 'क्या आप वाकई इस वार्तालाप को हटाना चाहते हैं?'; + + @override + String get streamChatLabel => 'स्ट्रीम चैट'; + + @override + String get searchingForNetworkLabel => 'नेटवर्क खोज रहे हैं'; + + @override + String get offlineLabel => 'ऑफलाइन...'; + + @override + String get tryAgainLabel => 'पुनः प्रयास करें'; + + @override + String membersCountText(int count) { + if (count == 1) return '1 सदस्य'; + return '$count सदस्य'; + } + + @override + String watchersCountText(int count) { + if (count == 1) return '1 ऑनलाइन'; + return '$count ऑनलाइन'; + } + + @override + String get viewInfoLabel => 'जानकारी देखें'; + + @override + String get leaveGroupLabel => 'समूह छोड़े'; + + @override + String get leaveLabel => 'छोड़े'; + + @override + String get leaveConversationLabel => 'वार्तालाप छोड़े'; + + @override + String get leaveConversationQuestion => + 'क्या आप वाकई इस बातचीत को छोड़ना चाहते हैं?'; + + @override + String get showInChatLabel => 'चैट में दिखाएं'; + + @override + String get saveImageLabel => 'चित्र को सेव करें'; + + @override + String get saveVideoLabel => 'वीडियो को सेव करे'; + + @override + String get uploadErrorLabel => 'अपलोड समस्या'; + + @override + String get giphyLabel => 'जिफ़ी'; + + @override + String get shuffleLabel => 'बदलें'; + + @override + String get sendLabel => 'भेजें'; + + @override + String get withText => 'विद'; + + @override + String get inText => 'इन'; + + @override + String get youText => 'आप'; + + @override + String get ofText => 'ऑफ़'; + + @override + String get fileText => 'फ़ाइल'; +} From cdee8c9ef29fbcac6c3a9d52c7bee1b58883a95e Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 20 Jul 2021 19:47:56 +0530 Subject: [PATCH 09/35] fix(Jiffy): check if locale is supported before setting it Signed-off-by: xsahil03x --- packages/stream_chat_flutter/lib/src/stream_chat.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index f55f565d..5dab2fd5 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -136,7 +136,11 @@ class StreamChatState extends State { @override void didChangeDependencies() { final locale = ui.window.locale; - Jiffy.locale(locale.languageCode); + final languageCode = locale.languageCode; + final availableLocales = Jiffy.getAllAvailableLocales(); + if (availableLocales.contains(languageCode)) { + Jiffy.locale(languageCode); + } super.didChangeDependencies(); } } From 9ea43f086985197f4d03691abdfde59fb401b274 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 21 Jul 2021 12:44:14 +0200 Subject: [PATCH 10/35] add localization scope in pr title --- .github/workflows/pr_title.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index 732c4164..c6ab1635 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -20,6 +20,7 @@ jobs: core ui repo + localization requireScope: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From ad8ddba6a71ebb3c025edcff6d2b69bc321e9e7f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 21 Jul 2021 17:44:51 +0530 Subject: [PATCH 11/35] chore(ui,localization): add translations for `replyToMessageLabel` Signed-off-by: xsahil03x --- packages/stream_chat_flutter/example/lib/main.dart | 12 ++---------- .../lib/src/localization/translations.dart | 5 +++++ .../stream_chat_flutter/lib/src/message_input.dart | 6 +++--- .../lib/src/stream_chat_localizations_en.dart | 3 +++ .../lib/src/stream_chat_localizations_hi.dart | 3 +++ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index d643dfea..f7609f6b 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -70,16 +70,8 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) => MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), - supportedLocales: const [ - Locale('en'), - Locale('hi'), - ], - localizationsDelegates: const [ - GlobalStreamChatLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ], + supportedLocales: const [Locale('en'), Locale('hi')], + localizationsDelegates: GlobalStreamChatLocalizations.delegates, builder: (context, widget) => StreamChat( client: client, child: widget, diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 4344dc8a..7ce7a507 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -196,6 +196,8 @@ abstract class Translations { String get ofText; String get fileText; + + String get replyToMessageLabel; } class DefaultTranslations implements Translations { @@ -548,4 +550,7 @@ class DefaultTranslations implements Translations { @override String get fileText => 'File'; + + @override + String get replyToMessageLabel => 'Reply to Message'; } diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index e5e6ca48..9d9ada07 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -357,9 +357,9 @@ class MessageInputState extends State { color: _streamChatTheme.colorTheme.disabled, ), ), - const Text( - 'Reply to Message', - style: TextStyle(fontWeight: FontWeight.bold), + Text( + context.translations.replyToMessageLabel, + style: const TextStyle(fontWeight: FontWeight.bold), ), IconButton( visualDensity: VisualDensity.compact, diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 88b88840..2cd88989 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -351,4 +351,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @override String get fileText => 'File'; + + @override + String get replyToMessageLabel => 'Reply to Message'; } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index 5666b77d..c4c4a33a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -350,4 +350,7 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { @override String get fileText => 'फ़ाइल'; + + @override + String get replyToMessageLabel => 'संदेश का जवाब'; } From b59b8a0050ff0454f508a1628613dc65a7429c0c Mon Sep 17 00:00:00 2001 From: Sacha Arbonel Date: Wed, 21 Jul 2021 09:51:39 -0400 Subject: [PATCH 12/35] add french translations --- .../lib/src/stream_chat_localizations.dart | 6 +- .../lib/src/stream_chat_localizations_fr.dart | 360 ++++++++++++++++++ 2 files changed, 364 insertions(+), 2 deletions(-) create mode 100644 packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index 82662134..03147834 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -6,7 +6,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart' show StreamChatLocalizations, User; part 'stream_chat_localizations_en.dart'; - +part 'stream_chat_localizations_fr.dart'; part 'stream_chat_localizations_hi.dart'; /// The set of supported languages, as language code strings. @@ -17,7 +17,7 @@ part 'stream_chat_localizations_hi.dart'; /// See also: /// /// * [getStreamChatTranslation], whose documentation describes these values. -const kStreamChatSupportedLanguages = {'en', 'hi'}; +const kStreamChatSupportedLanguages = {'en', 'hi', 'fr'}; /// Creates a [GlobalStreamChatLocalizations] instance for the given `locale`. /// @@ -43,6 +43,8 @@ GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) { return const StreamChatLocalizationsEn(); case 'hi': return const StreamChatLocalizationsHi(); + case 'fr': + return const StreamChatLocalizationsFr(); } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart new file mode 100644 index 00000000..c35fff27 --- /dev/null +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -0,0 +1,360 @@ +part of 'stream_chat_localizations.dart'; + +/// The translations for English (`fr`). +class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { + /// Create an instance of the translation bundle for French. + const StreamChatLocalizationsFr({String localeName = 'fr'}) + : super(localeName: localeName); + + @override + String get launchUrlError => "Impossible de lancer l'url"; + + @override + String get loadingUsersError => 'Erreur de chargement des utilisateurs'; + + @override + String get noUsersLabel => "Il n'y a pas d'utilisateurs actuellement"; + + @override + String get retryLabel => 'Réessayer'; + + @override + String get userLastOnlineText => 'Dernière fois en ligne'; + + @override + String get userOnlineText => 'En ligne'; + + @override + String userTypingText(Iterable users) { + if (users.isEmpty) return ''; + final first = users.first; + if (users.length == 1) { + return "${first.name} est en train d'écrire"; + } + return "${first.name} and ${users.length - 1} sont entrain d'écrire"; + } + + @override + String get threadReplyLabel => 'Réponse au fil de discussion'; + + @override + String get onlyVisibleToYouText => 'Seulement visible par vous'; + + @override + String threadReplyCountText(int count) => + "$count Réponses au fil d'actualité"; + + @override + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }) => + 'Uploading $remaining/$total ...'; + + @override + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }) { + final pinnedByCurrentUser = currentUser.id == pinnedBy.id; + if (pinnedByCurrentUser) return 'Épinglé par vous'; + return 'Épinglé par ${pinnedBy.name}'; + } + + @override + String get emptyMessagesText => "Il n'y a pas de messages actuellement"; + + @override + String get genericErrorText => 'Il y a eu un problème'; + + @override + String get loadingMessagesError => 'Erreur de chargement des messages'; + + @override + String resultCountText(int count) => '$count résultats'; + + @override + String get messageDeletedText => 'Ce message a été supprimé.'; + + @override + String get messageDeletedLabel => 'Message supprimé'; + + @override + String get messageReactionsText => 'Réactions aux messages'; + + @override + String get emptyChatMessagesText => 'Pas encore de chats ici...'; + + @override + String threadSeparatorText(int replyCount) { + if (replyCount == 1) return '1 Réponse'; + return '$replyCount Replies'; + } + + @override + String get connectedLabel => 'Connecté'; + + @override + String get disconnectedLabel => 'Déconnecté'; + + @override + String get reconnectingLabel => 'Reconnexion...'; + + @override + String get alsoSendAsDirectMessageLabel => + 'Envoyer aussi comme message direct'; + + @override + String get addACommentOrSendLabel => 'Ajouter un commentaire ou envoyer'; + + @override + String get searchGifLabel => 'Recherche de GIFs'; + + @override + String get writeAMessageLabel => 'Écrire un message'; + + @override + String get instantCommandsLabel => 'Commandes instantanées'; + + @override + String get fileTooLargeAfterCompressionError => + 'Le fichier est trop volumineux pour être téléchargé. ' + 'La taille maximale des fichiers est de 20 Mo. ' + "Nous avons essayé de le compresser, mais ce n'était pas suffisant."; + + @override + String get fileTooLargeError => + 'Le fichier est trop volumineux pour être téléchargé. La taille limite du fichier est de 20 Mo.'; + + @override + String emojiMatchingQueryText(String query) => + 'Emoji qui correspond à "$query"'; + + @override + String get addAFileLabel => 'Ajouter un fichier'; + + @override + String get photoFromCameraLabel => "Photo de l'appareil photo"; + + @override + String get uploadAFileLabel => 'Transférer un fichier'; + + @override + String get uploadAPhotoLabel => 'Transférer une photo'; + + @override + String get uploadAVideoLabel => 'Transférer une vidéo'; + + @override + String get videoFromCameraLabel => 'Vidéo depuis la camera'; + + @override + String get okLabel => 'OK'; + + @override + String get somethingWentWrongLabel => 'Quelque chose a mal tourné'; + + @override + String get addMoreFilesLabel => "Ajouter d'autres fichiers"; + + @override + String get enablePhotoAndVideoAccessMessage => + "Veuillez autoriser l'accès à vos photos" + '\net vidéos afin de pouvoir les partager avec vos amis.'; + + @override + String get allowGalleryAccessMessage => "Autoriser l'accès à votre galerie"; + + @override + String get flagMessageLabel => 'Signaler un message'; + + @override + String get flagMessageQuestion => + 'Voulez-vous envoyer une copie de ce message à une' + '\modérateur pour une enquête plus approfondie ?'; + + @override + String get flagLabel => 'SIGNALER'; + + @override + String get cancelLabel => 'ANNULER'; + + @override + String get flagMessageSuccessfulLabel => 'Message signalé'; + + @override + String get flagMessageSuccessfulText => + 'Ce message a été signalé à un modérateur.'; + + @override + String get deleteLabel => 'SUPPRIMER'; + + @override + String get deleteMessageLabel => 'Supprimer le message'; + + @override + String get deleteMessageQuestion => + 'Êtes-vous sûr de vouloir supprimer définitivement ce\nmessage ?'; + + @override + String get operationCouldNotBeCompletedText => + "L'opération n'a pas pu être terminée."; + + @override + String get replyLabel => 'Répondre'; + + @override + String togglePinUnpinText({required bool pinned}) { + if (pinned) return 'Détacher de la conversation'; + return 'Attacher à la conversation'; + } + + @override + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}) { + if (isDeleteFailed) return 'Retenter de supprimer le message'; + return 'Supprimer le message'; + } + + @override + String get copyMessageLabel => 'Copier le message'; + + @override + String get editMessageLabel => 'Modifier le message'; + + @override + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}) { + if (isUpdateFailed) return 'Renvoyer le message modifié'; + return 'Renvoyer'; + } + + @override + String get photosLabel => 'Photos'; + + String _getDay(DateTime dateTime) { + final now = Jiffy(DateTime.now()); + final date = Jiffy(dateTime); + + if (date.isSame(now, Units.DAY)) { + return "aujourd'hui"; + } else if (now.diff(date, Units.HOUR) < 24) { + return 'hier'; + } else { + return 'le ${date.MMMd}'; //hmm lookup french format d/MM/yyyy + } + } + + @override + String sentAtText({required DateTime date, required DateTime time}) => + 'Envoyé ${_getDay(date)} à ${Jiffy(time.toLocal()).format('HH:mm')}'; + + @override + String get todayLabel => "Aujourd'hui"; + + @override + String get yesterdayLabel => 'Hier'; + + @override + String get channelIsMutedText => 'Le canal est coupé'; + + @override + String get noTitleText => 'Aucun titre'; + + @override + String get letsStartChattingLabel => 'Commençons à discuter !'; + + @override + String get sendingFirstMessageLabel => + "Que diriez-vous d'envoyer votre premier message à un ami ?"; + + @override + String get startAChatLabel => 'Commencer une discussion'; + + @override + String get loadingChannelsError => 'Erreur lors du chargement des canaux'; + + @override + String get deleteConversationLabel => 'Supprimer la conversation'; + + @override + String get deleteConversationQuestion => + 'Vous êtes sûr de vouloir supprimer cette conversation ?'; + + @override + String get streamChatLabel => 'Stream Chat'; + + @override + String get searchingForNetworkLabel => 'Recherche de réseau'; + + @override + String get offlineLabel => 'Hors ligne...'; + + @override + String get tryAgainLabel => 'Essayer à nouveau'; + + @override + String membersCountText(int count) { + if (count == 1) return '1 Membre'; + return '$count Membres'; + } + + @override + String watchersCountText(int count) { + if (count == 1) return '1 En ligne'; + return '$count En ligne'; + } + + @override + String get viewInfoLabel => 'Voir les informations'; + + @override + String get leaveGroupLabel => 'Quitter le Group'; + + @override + String get leaveLabel => 'QUITTER'; + + @override + String get leaveConversationLabel => 'Quitter la conversation'; + + @override + String get leaveConversationQuestion => + 'Etes-vous sûr de vouloir quitter cette conversation ?'; + + @override + String get showInChatLabel => 'Montrer dans le Chat'; + + @override + String get saveImageLabel => "Sauvegarder l'image"; + + @override + String get saveVideoLabel => 'Sauvegarder la vidéo'; + + @override + String get uploadErrorLabel => 'ERREUR DE TRANSFERT'; + + @override + String get giphyLabel => 'Giphy'; + + @override + String get shuffleLabel => 'Mélanger'; + + @override + String get sendLabel => 'Envoyer'; + + @override + String get withText => 'avec'; + + @override + String get inText => 'dans'; + + @override + String get youText => 'Vous'; + + @override + String get ofText => 'de'; + + @override + String get fileText => 'Fichier'; + + @override + String get replyToMessageLabel => 'Répondre au Message'; +} From dbbd79b6f1d3549a30423c71e810e8ecde2c5e9c Mon Sep 17 00:00:00 2001 From: Sacha Arbonel Date: Wed, 21 Jul 2021 10:03:59 -0400 Subject: [PATCH 13/35] Update packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart typo Co-authored-by: Sahil Kumar --- .../lib/src/stream_chat_localizations_fr.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index c35fff27..98661a06 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -171,7 +171,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { @override String get flagMessageQuestion => 'Voulez-vous envoyer une copie de ce message à une' - '\modérateur pour une enquête plus approfondie ?'; + '\nmodérateur pour une enquête plus approfondie ?'; @override String get flagLabel => 'SIGNALER'; From f959a60dc426034fbe86c17d958021064e3b0750 Mon Sep 17 00:00:00 2001 From: Sacha Arbonel Date: Wed, 21 Jul 2021 10:05:10 -0400 Subject: [PATCH 14/35] more typos --- .../lib/src/stream_chat_localizations_fr.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index 98661a06..e9576045 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -42,7 +42,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { @override String threadReplyCountText(int count) => - "$count Réponses au fil d'actualité"; + "$count Réponses au fil de discussion"; @override String attachmentsUploadProgressText({ @@ -170,7 +170,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { @override String get flagMessageQuestion => - 'Voulez-vous envoyer une copie de ce message à une' + 'Voulez-vous envoyer une copie de ce message à un' '\nmodérateur pour une enquête plus approfondie ?'; @override From 0abac8fc2788686d77105f20b6568b7ded640e54 Mon Sep 17 00:00:00 2001 From: Sacha Arbonel Date: Wed, 21 Jul 2021 10:06:35 -0400 Subject: [PATCH 15/35] clean up comment --- .../lib/src/stream_chat_localizations_fr.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index e9576045..3c26a071 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -239,7 +239,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { } else if (now.diff(date, Units.HOUR) < 24) { return 'hier'; } else { - return 'le ${date.MMMd}'; //hmm lookup french format d/MM/yyyy + return 'le ${date.MMMd}'; } } From 5097e4844b04ead4b0d2772190a67cfe66046087 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 21 Jul 2021 16:38:59 +0200 Subject: [PATCH 16/35] add italian translation --- .../lib/src/stream_chat_localizations.dart | 10 +- .../lib/src/stream_chat_localizations_hi.dart | 2 +- .../lib/src/stream_chat_localizations_it.dart | 358 ++++++++++++++++++ 3 files changed, 368 insertions(+), 2 deletions(-) create mode 100644 packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index 03147834..d0b1f6dc 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -7,6 +7,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart' part 'stream_chat_localizations_en.dart'; part 'stream_chat_localizations_fr.dart'; +part 'stream_chat_localizations_it.dart'; part 'stream_chat_localizations_hi.dart'; /// The set of supported languages, as language code strings. @@ -17,7 +18,12 @@ part 'stream_chat_localizations_hi.dart'; /// See also: /// /// * [getStreamChatTranslation], whose documentation describes these values. -const kStreamChatSupportedLanguages = {'en', 'hi', 'fr'}; +const kStreamChatSupportedLanguages = { + 'en', + 'hi', + 'fr', + 'it', +}; /// Creates a [GlobalStreamChatLocalizations] instance for the given `locale`. /// @@ -45,6 +51,8 @@ GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) { return const StreamChatLocalizationsHi(); case 'fr': return const StreamChatLocalizationsFr(); + case 'it': + return const StreamChatLocalizationsIt(); } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index c4c4a33a..e32b4a4d 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -1,6 +1,6 @@ part of 'stream_chat_localizations.dart'; -/// The translations for English (`hi`). +/// The translations for Hindi (`hi`). class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Hindi. const StreamChatLocalizationsHi({String localeName = 'hi'}) diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart new file mode 100644 index 00000000..0edcbd0a --- /dev/null +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -0,0 +1,358 @@ +part of 'stream_chat_localizations.dart'; + +/// The translations for English (`hi`). +class StreamChatLocalizationsIt extends GlobalStreamChatLocalizations { + /// Create an instance of the translation bundle for Hindi. + const StreamChatLocalizationsIt({String localeName = 'it'}) + : super(localeName: localeName); + + @override + String get launchUrlError => 'Impossibile aprire l\'url'; + + @override + String get loadingUsersError => 'Errore durante il carimento degli utenti'; + + @override + String get noUsersLabel => 'Non c\'é nessun utente al momento'; + + @override + String get retryLabel => 'Riprova'; + + @override + String get userLastOnlineText => 'Ultimo accesso'; + + @override + String get userOnlineText => 'Online'; + + @override + String userTypingText(Iterable users) { + if (users.isEmpty) return ''; + final first = users.first; + if (users.length == 1) { + return '${first.name} sta scrivendo'; + } + return '${first.name} e altri ${users.length - 1} stanno scrivendo'; + } + + @override + String get threadReplyLabel => 'Rispondi nel thread'; + + @override + String get onlyVisibleToYouText => 'Visible solo a te'; + + @override + String threadReplyCountText(int count) => '$count risposte al thread'; + + @override + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }) => + 'Caricamento $remaining/$total ...'; + + @override + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }) { + final pinnedByCurrentUser = currentUser.id == pinnedBy.id; + if (pinnedByCurrentUser) return 'Messo in evidenza da te'; + return 'Messo in evidenza da ${pinnedBy.name}'; + } + + @override + String get emptyMessagesText => 'Non c\'é nessun messaggio al momento'; + + @override + String get genericErrorText => 'Qualcosa è andato storto'; + + @override + String get loadingMessagesError => + 'Errore durante il caricamento dei messaggi'; + + @override + String resultCountText(int count) => '$count risultati'; + + @override + String get messageDeletedText => 'Questo messaggio è stato eliminato'; + + @override + String get messageDeletedLabel => 'Messaggio cancellato'; + + @override + String get messageReactionsText => 'Reazioni al messaggio'; + + @override + String get emptyChatMessagesText => 'Nessuna conversazione al momento...'; + + @override + String threadSeparatorText(int replyCount) { + if (replyCount == 1) return '1 risposta'; + return '$replyCount risposte'; + } + + @override + String get connectedLabel => 'Connesso'; + + @override + String get disconnectedLabel => 'Disconnesso'; + + @override + String get reconnectingLabel => 'Riconnessione in corso...'; + + @override + String get alsoSendAsDirectMessageLabel => + 'Manda anche come messaggio diretto'; + + @override + String get addACommentOrSendLabel => 'Aggiungi un commento o invia'; + + @override + String get searchGifLabel => 'Cerca una GIF'; + + @override + String get writeAMessageLabel => 'Scrivi un messaggio'; + + @override + String get instantCommandsLabel => 'Commandi istantanei'; + + @override + String get fileTooLargeAfterCompressionError => + 'Il file è troppo grande per essere caricato. ' + 'Il file eccede il limite di 20MB. ' + 'Abbiamo provato a comprimerlo, ma non è stato abbastanza.'; + + @override + String get fileTooLargeError => + 'Il file è troppo grande per essere caricato. Il limite è di 20MB.'; + + @override + String emojiMatchingQueryText(String query) => 'Emoji per "$query"'; + + @override + String get addAFileLabel => 'Aggiungi un file'; + + @override + String get photoFromCameraLabel => 'Immagine dalla fotocamera'; + + @override + String get uploadAFileLabel => 'Carica un file'; + + @override + String get uploadAPhotoLabel => 'Carica una foto'; + + @override + String get uploadAVideoLabel => 'Carica un video'; + + @override + String get videoFromCameraLabel => 'Video dalla fotocamera'; + + @override + String get okLabel => 'Ok'; + + @override + String get somethingWentWrongLabel => 'Qualcosa è andato storto'; + + @override + String get addMoreFilesLabel => 'Aggiungi altri file'; + + @override + String get enablePhotoAndVideoAccessMessage => + 'Per favore attiva l\'accesso alle foto' + '\ne ai video cosí potrai condividerli con i tuoi amici.'; + + @override + String get allowGalleryAccessMessage => 'Permetti l\'accesso alla galleria'; + + @override + String get flagMessageLabel => 'Segnala messaggio'; + + @override + String get flagMessageQuestion => 'Vuoi mandare una copia di questo messaggio' + '\nad un moderatore?'; + + @override + String get flagLabel => 'SEGNALA'; + + @override + String get cancelLabel => 'ANNULLA'; + + @override + String get flagMessageSuccessfulLabel => 'Messaggio segnalato'; + + @override + String get flagMessageSuccessfulText => + 'Questo messaggio è stato segnalato ad un moderatore.'; + + @override + String get deleteLabel => 'CANCELLA'; + + @override + String get deleteMessageLabel => 'Cancella messaggio'; + + @override + String get deleteMessageQuestion => + 'Sei sicuro di voler definitivamente cancellare questo\nmessaggio?'; + + @override + String get operationCouldNotBeCompletedText => + 'Non è stato possibile completare questa operazione.'; + + @override + String get replyLabel => 'Rispondi'; + + @override + String togglePinUnpinText({required bool pinned}) { + if (pinned) return 'Rimuovi dagli elementi in evidenza'; + return 'Metti in evidenza'; + } + + @override + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}) { + if (isDeleteFailed) return 'Riprova a cancellare il messaggio'; + return 'Cancella il messaggio'; + } + + @override + String get copyMessageLabel => 'Copia messaggio'; + + @override + String get editMessageLabel => 'Modifica messaggio'; + + @override + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}) { + if (isUpdateFailed) return 'Riprova modifica messaggio'; + return 'Riprova'; + } + + @override + String get photosLabel => 'Foto'; + + String _getDay(DateTime dateTime) { + final now = Jiffy(DateTime.now()); + final date = Jiffy(dateTime); + + if (date.isSame(now, Units.DAY)) { + return 'oggi'; + } else if (now.diff(date, Units.HOUR) < 24) { + return 'ieri'; + } else { + return 'il ${date.MMMd}'; + } + } + + @override + String sentAtText({required DateTime date, required DateTime time}) => ''' +Inviato il ${_getDay(date)} alle ${Jiffy(time.toLocal()).format('HH:mm')}'''; + + @override + String get todayLabel => 'Oggi'; + + @override + String get yesterdayLabel => 'Ieri'; + + @override + String get channelIsMutedText => 'Il canale è mutato'; + + @override + String get noTitleText => 'Nessun titolo'; + + @override + String get letsStartChattingLabel => 'Inizia una conversazione!'; + + @override + String get sendingFirstMessageLabel => + 'Che ne dici di mandare il tuo primo messaggio ad un amico?'; + + @override + String get startAChatLabel => 'Inizia una conversazione'; + + @override + String get loadingChannelsError => 'Errore durante il caricamento dei canali'; + + @override + String get deleteConversationLabel => 'Elemina conversazione'; + + @override + String get deleteConversationQuestion => + 'Sei sicuro di voler eliminare questa conversazione?'; + + @override + String get streamChatLabel => 'Stream Chat'; + + @override + String get searchingForNetworkLabel => 'Cercando una connessione'; + + @override + String get offlineLabel => 'Offline...'; + + @override + String get tryAgainLabel => 'Riprova'; + + @override + String membersCountText(int count) { + if (count == 1) return '1 membro'; + return '$count membri'; + } + + @override + String watchersCountText(int count) { + if (count == 1) return '1 Online'; + return '$count Online'; + } + + @override + String get viewInfoLabel => 'Vedi info'; + + @override + String get leaveGroupLabel => 'Esci dal gruppo'; + + @override + String get leaveLabel => 'ESCI'; + + @override + String get leaveConversationLabel => 'Esci dalla conversazione'; + + @override + String get leaveConversationQuestion => + 'Sei sicuro di voler lasciare questa conversazione?'; + + @override + String get showInChatLabel => 'Mostra nella chat'; + + @override + String get saveImageLabel => 'Salva immagine'; + + @override + String get saveVideoLabel => 'Salva video'; + + @override + String get uploadErrorLabel => 'ERRORE DURANTE IL CARICAMENTO'; + + @override + String get giphyLabel => 'Giphy'; + + @override + String get shuffleLabel => 'Shuffle'; + + @override + String get sendLabel => 'Invia'; + + @override + String get withText => 'con'; + + @override + String get inText => 'in'; + + @override + String get youText => 'te'; + + @override + String get ofText => 'di'; + + @override + String get fileText => 'file'; + + @override + String get replyToMessageLabel => 'Rispondi al messaggio'; +} From f1df4389b59007c708d292715ace00b997129dbe Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 21 Jul 2021 16:49:40 +0200 Subject: [PATCH 17/35] add file size limit parameter --- .../stream_chat_flutter/example/lib/main.dart | 7 ++++++- .../lib/src/localization/translations.dart | 12 ++++++------ .../lib/src/message_input.dart | 16 ++++++++++++---- .../lib/src/stream_chat_localizations_en.dart | 8 ++++---- .../lib/src/stream_chat_localizations_fr.dart | 8 ++++---- .../lib/src/stream_chat_localizations_hi.dart | 8 ++++---- .../lib/src/stream_chat_localizations_it.dart | 8 ++++---- 7 files changed, 40 insertions(+), 27 deletions(-) diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index f7609f6b..b340ac28 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -70,7 +70,12 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) => MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), - supportedLocales: const [Locale('en'), Locale('hi')], + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('it'), + ], localizationsDelegates: GlobalStreamChatLocalizations.delegates, builder: (context, widget) => StreamChat( client: client, diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 7ce7a507..6a7ac657 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -67,9 +67,9 @@ abstract class Translations { String get instantCommandsLabel; - String get fileTooLargeAfterCompressionError; + String fileTooLargeAfterCompressionError(double limitInMB); - String get fileTooLargeError; + String fileTooLargeError(double limitInMB); String emojiMatchingQueryText(String query); @@ -314,14 +314,14 @@ class DefaultTranslations implements Translations { String get instantCommandsLabel => 'Instant Commands'; @override - String get fileTooLargeAfterCompressionError => + String fileTooLargeAfterCompressionError(double limitInMB) => 'The file is too large to upload. ' - 'The file size limit is 20MB. ' + 'The file size limit is $limitInMB MB. ' 'We tried compressing it, but it was not enough.'; @override - String get fileTooLargeError => - 'The file is too large to upload. The file size limit is 20MB.'; + String fileTooLargeError(double limitInMB) => + 'The file is too large to upload. The file size limit is $limitInMB MB.'; @override String emojiMatchingQueryText(String query) => 'Emoji matching "$query"'; diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 9d9ada07..7843e77e 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -1144,7 +1144,9 @@ class MessageInputState extends State { if (mediaInfo.filesize! > widget.maxAttachmentSize) { _showErrorAlert( - context.translations.fileTooLargeAfterCompressionError, + context.translations.fileTooLargeAfterCompressionError( + widget.maxAttachmentSize / (1024 * 1024), + ), ); return; } @@ -1155,7 +1157,9 @@ class MessageInputState extends State { path: mediaInfo.path, ); } else { - _showErrorAlert(context.translations.fileTooLargeError); + _showErrorAlert(context.translations.fileTooLargeError( + widget.maxAttachmentSize / (1024 * 1024), + )); return; } } @@ -1922,7 +1926,9 @@ class MessageInputState extends State { if (mediaInfo.filesize! > widget.maxAttachmentSize) { _showErrorAlert( - context.translations.fileTooLargeAfterCompressionError, + context.translations.fileTooLargeAfterCompressionError( + widget.maxAttachmentSize / (1024 * 1024), + ), ); return; } @@ -1933,7 +1939,9 @@ class MessageInputState extends State { path: mediaInfo.path, ); } else { - _showErrorAlert(context.translations.fileTooLargeError); + _showErrorAlert(context.translations.fileTooLargeError( + widget.maxAttachmentSize / (1024 * 1024), + )); return; } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 2cd88989..ba515e2f 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -115,14 +115,14 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get instantCommandsLabel => 'Instant Commands'; @override - String get fileTooLargeAfterCompressionError => + String fileTooLargeAfterCompressionError(double limitInMB) => 'The file is too large to upload. ' - 'The file size limit is 20MB. ' + 'The file size limit is $limitInMB MB. ' 'We tried compressing it, but it was not enough.'; @override - String get fileTooLargeError => - 'The file is too large to upload. The file size limit is 20MB.'; + String fileTooLargeError(double limitInMB) => + 'The file is too large to upload. The file size limit is $limitInMB MB.'; @override String emojiMatchingQueryText(String query) => 'Emoji matching "$query"'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index 3c26a071..297fbc1a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -117,14 +117,14 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { String get instantCommandsLabel => 'Commandes instantanées'; @override - String get fileTooLargeAfterCompressionError => + String fileTooLargeAfterCompressionError(double limitInMB) => 'Le fichier est trop volumineux pour être téléchargé. ' - 'La taille maximale des fichiers est de 20 Mo. ' + 'La taille maximale des fichiers est de $limitInMB Mo. ' "Nous avons essayé de le compresser, mais ce n'était pas suffisant."; @override - String get fileTooLargeError => - 'Le fichier est trop volumineux pour être téléchargé. La taille limite du fichier est de 20 Mo.'; + String fileTooLargeError(double limitInMB) => + 'Le fichier est trop volumineux pour être téléchargé. La taille limite du fichier est de $limitInMB Mo.'; @override String emojiMatchingQueryText(String query) => diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index e32b4a4d..c6e94e32 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -115,14 +115,14 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { String get instantCommandsLabel => 'तत्काल आदेश'; @override - String get fileTooLargeAfterCompressionError => + String fileTooLargeAfterCompressionError(double limitInMB) => 'फ़ाइल अपलोड करने के लिए बहुत बड़ी है। ' - 'फ़ाइल आकार सीमा 20MB है। ' + 'फ़ाइल आकार सीमा $limitInMB MB है। ' 'हमने इसे कंप्रेस करने की कोशिश की, लेकिन यह काफी नहीं था।'; @override - String get fileTooLargeError => - 'फ़ाइल अपलोड करने के लिए बहुत बड़ी है। फ़ाइल आकार सीमा 20MB है।'; + String fileTooLargeError(double limitInMB) => + 'फ़ाइल अपलोड करने के लिए बहुत बड़ी है। फ़ाइल आकार सीमा $limitInMB MB है।'; @override String emojiMatchingQueryText(String query) => '"$query" से मिलते हुए इमोजी'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index 0edcbd0a..8797de27 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -117,14 +117,14 @@ class StreamChatLocalizationsIt extends GlobalStreamChatLocalizations { String get instantCommandsLabel => 'Commandi istantanei'; @override - String get fileTooLargeAfterCompressionError => + String fileTooLargeAfterCompressionError(double limitInMB) => 'Il file è troppo grande per essere caricato. ' - 'Il file eccede il limite di 20MB. ' + 'Il file eccede il limite di $limitInMB MB. ' 'Abbiamo provato a comprimerlo, ma non è stato abbastanza.'; @override - String get fileTooLargeError => - 'Il file è troppo grande per essere caricato. Il limite è di 20MB.'; + String fileTooLargeError(double limitInMB) => ''' +Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; @override String emojiMatchingQueryText(String query) => 'Emoji per "$query"'; From c88a9a5c04eb557eae78ff79d98d983266b9a983 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 21 Jul 2021 16:53:26 +0200 Subject: [PATCH 18/35] use pub stream_chat_flutter dependency --- packages/stream_chat_localizations/pubspec.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index b755a6dd..ac999a9c 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -12,8 +12,7 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - stream_chat_flutter: - path: ../stream_chat_flutter + stream_chat_flutter: ^2.0.0 dev_dependencies: flutter_test: From df834f4c8b5209db02003209f26638bc36808df1 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 21 Jul 2021 21:11:08 +0530 Subject: [PATCH 19/35] test(localization): add unit tests Signed-off-by: xsahil03x --- .../test/basics_test.dart | 109 +++++++ .../test/override_test.dart | 276 ++++++++++++++++++ .../test/stream_chat_localization_test.dart | 20 -- .../test/translations_test.dart | 164 +++++++++++ 4 files changed, 549 insertions(+), 20 deletions(-) create mode 100644 packages/stream_chat_localizations/test/basics_test.dart create mode 100644 packages/stream_chat_localizations/test/override_test.dart delete mode 100644 packages/stream_chat_localizations/test/stream_chat_localization_test.dart create mode 100644 packages/stream_chat_localizations/test/translations_test.dart diff --git a/packages/stream_chat_localizations/test/basics_test.dart b/packages/stream_chat_localizations/test/basics_test.dart new file mode 100644 index 00000000..c1315a9a --- /dev/null +++ b/packages/stream_chat_localizations/test/basics_test.dart @@ -0,0 +1,109 @@ +// ignore_for_file: omit_local_variable_types + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:stream_chat_localizations/src/stream_chat_localizations.dart'; + +void main() { + testWidgets('Nested Localizations', (WidgetTester tester) async { + await tester.pumpWidget(MaterialApp( + // Creates the outer Localizations widget. + home: ListView( + children: [ + const LocalizationTracker(key: ValueKey('outer')), + Localizations( + locale: const Locale('hi'), + delegates: GlobalStreamChatLocalizations.delegates, + child: const LocalizationTracker(key: ValueKey('inner')), + ), + ], + ), + )); + + final LocalizationTrackerState outerTracker = tester.state( + find.byKey(const ValueKey('outer'), skipOffstage: false)); + expect(outerTracker.captionFontSize, 12.0); + final LocalizationTrackerState innerTracker = tester.state( + find.byKey(const ValueKey('inner'), skipOffstage: false)); + expect(innerTracker.captionFontSize, 13.0); + }); + + testWidgets( + 'Localizations is compatible with ChangeNotifier.dispose() called ' + 'during didChangeDependencies', + (WidgetTester tester) async { + // PageView calls ScrollPosition.dispose() during didChangeDependencies. + await tester.pumpWidget(MaterialApp( + supportedLocales: const [ + Locale('en', 'US'), + Locale('hi', 'IN'), + ], + localizationsDelegates: const [ + DummyLocalizations.delegate, + GlobalStreamChatLocalizations.delegate, + ], + home: PageView(), + )); + + await tester.binding.setLocale('hi', 'IN'); + await tester.pump(); + await tester.pumpWidget(Container()); + }, + ); + + testWidgets('Locale without countryCode', (WidgetTester tester) async { + // Regression test for https://github.com/flutter/flutter/pull/16782 + await tester.pumpWidget(MaterialApp( + localizationsDelegates: const >[ + GlobalStreamChatLocalizations.delegate, + ], + supportedLocales: const [ + Locale('en', 'US'), + Locale('hi'), + ], + home: Container(), + )); + + await tester.binding.setLocale('hi', ''); + await tester.pump(); + await tester.binding.setLocale('en', 'US'); + await tester.pump(); + }); +} + +/// A localizations delegate that does not contain any useful data, and is only +/// used to trigger didChangeDependencies upon locale change. +class _DummyLocalizationsDelegate + extends LocalizationsDelegate { + const _DummyLocalizationsDelegate(); + + @override + Future load(Locale locale) async => DummyLocalizations(); + + @override + bool isSupported(Locale locale) => true; + + @override + bool shouldReload(_DummyLocalizationsDelegate old) => true; +} + +class DummyLocalizations { + static const delegate = _DummyLocalizationsDelegate(); +} + +class LocalizationTracker extends StatefulWidget { + const LocalizationTracker({Key? key}) : super(key: key); + + @override + State createState() => LocalizationTrackerState(); +} + +class LocalizationTrackerState extends State { + late double captionFontSize; + + @override + Widget build(BuildContext context) { + captionFontSize = Theme.of(context).textTheme.caption!.fontSize!; + return Container(); + } +} diff --git a/packages/stream_chat_localizations/test/override_test.dart b/packages/stream_chat_localizations/test/override_test.dart new file mode 100644 index 00000000..3e134b6f --- /dev/null +++ b/packages/stream_chat_localizations/test/override_test.dart @@ -0,0 +1,276 @@ +// ignore_for_file: prefer_expression_function_bodies + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_localizations/src/stream_chat_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; + +class FooStreamChatLocalizations extends StreamChatLocalizationsEn { + FooStreamChatLocalizations( + Locale localeName, + this.launchUrlError, + ) : super(localeName: localeName.toString()); + + @override + final String launchUrlError; +} + +class FooStreamChatLocalizationsDelegate + extends LocalizationsDelegate { + const FooStreamChatLocalizationsDelegate({ + this.supportedLanguage = 'en', + this.launchUrlError = 'foo', + }); + + final String supportedLanguage; + final String launchUrlError; + + @override + bool isSupported(Locale locale) => + supportedLanguage == 'allLanguages' || + locale.languageCode == supportedLanguage; + + @override + Future load(Locale locale) => + SynchronousFuture( + FooStreamChatLocalizations(locale, launchUrlError), + ); + + @override + bool shouldReload(FooStreamChatLocalizationsDelegate old) => false; +} + +Widget buildFrame({ + Locale? locale, + Iterable delegates = + GlobalStreamChatLocalizations.delegates, + required WidgetBuilder buildContent, + LocaleResolutionCallback? localeResolutionCallback, + Iterable supportedLocales = const [ + Locale('en', 'US'), + Locale('hi', 'IN'), + ], +}) => + MaterialApp( + color: const Color(0xFFFFFFFF), + locale: locale, + supportedLocales: supportedLocales, + localizationsDelegates: delegates, + localeResolutionCallback: localeResolutionCallback, + onGenerateRoute: (RouteSettings settings) => MaterialPageRoute( + builder: (BuildContext context) => buildContent(context)), + ); + +void main() { + testWidgets( + 'Locale fallbacks', + (WidgetTester tester) async { + final Key textKey = UniqueKey(); + + await tester.pumpWidget( + buildFrame( + buildContent: (BuildContext context) => Text( + StreamChatLocalizations.of(context)!.launchUrlError, + key: textKey, + ), + ), + ); + + expect( + tester.widget(find.byKey(textKey)).data, + 'Cannot launch the url', + ); + + // Unrecognized locale falls back to 'en' + await tester.binding.setLocale('foo', 'BAR'); + await tester.pump(); + expect( + tester.widget(find.byKey(textKey)).data, + 'Cannot launch the url', + ); + + // Indian hindi locale, falls back to just 'hi' + await tester.binding.setLocale('hi', 'IN'); + await tester.pump(); + expect( + tester.widget(find.byKey(textKey)).data, + 'यूआरएल लॉन्च नहीं कर सकते', + ); + }, + ); + + testWidgets( + "Localizations.override widget tracks parent's locale", + (WidgetTester tester) async { + Widget buildLocaleFrame(Locale locale) => buildFrame( + locale: locale, + supportedLocales: [locale], + buildContent: (BuildContext context) => Localizations.override( + context: context, + child: Builder( + builder: (BuildContext context) { + // No StreamChatLocalizations are defined for the first + // Localizations ancestor, so we should get the values from + // the default one, i.e. the one created by WidgetsApp via + // the LocalizationsDelegate provided by MaterialApp. + return Text( + StreamChatLocalizations.of(context)!.launchUrlError, + ); + }, + ), + ), + ); + + await tester.pumpWidget(buildLocaleFrame(const Locale('en', 'US'))); + expect(find.text('Cannot launch the url'), findsOneWidget); + + await tester.pumpWidget(buildLocaleFrame(const Locale('hi', 'IN'))); + expect(find.text('यूआरएल लॉन्च नहीं कर सकते'), findsOneWidget); + }, + ); + + testWidgets('Localizations.override widget with hardwired locale', + (WidgetTester tester) async { + Widget buildLocaleFrame(Locale locale) => buildFrame( + locale: locale, + buildContent: (BuildContext context) { + return Localizations.override( + context: context, + locale: const Locale('en', 'US'), + child: Builder( + builder: (BuildContext context) { + // No StreamChatLocalizations are defined for the first + // Localizations ancestor, so we should get the values from + // the default one, i.e. the one created by WidgetsApp via + // the LocalizationsDelegate provided by MaterialApp. + return Text( + StreamChatLocalizations.of(context)!.launchUrlError, + ); + }, + ), + ); + }, + ); + + await tester.pumpWidget(buildLocaleFrame(const Locale('en', 'US'))); + expect(find.text('Cannot launch the url'), findsOneWidget); + + await tester.pumpWidget(buildLocaleFrame(const Locale('hi', 'IN'))); + expect(find.text('Cannot launch the url'), findsOneWidget); + }); + + testWidgets( + 'MaterialApp adds StreamChatLocalizations for additional languages', + (WidgetTester tester) async { + final Key textKey = UniqueKey(); + + await tester.pumpWidget(buildFrame( + delegates: >[ + GlobalStreamChatLocalizations.delegate, + const FooStreamChatLocalizationsDelegate( + supportedLanguage: 'fr', + launchUrlError: "Impossible de lancer l'url", + ), + const FooStreamChatLocalizationsDelegate( + supportedLanguage: 'de', + launchUrlError: 'Kann die URL nicht starten', + ), + ], + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('de'), + ], + buildContent: (BuildContext context) => Text( + StreamChatLocalizations.of(context)!.launchUrlError, + key: textKey, + ), + )); + + expect( + tester.widget(find.byKey(textKey)).data, + 'Cannot launch the url', + ); + + await tester.binding.setLocale('hi', 'IN'); + await tester.pump(); + expect(find.text('यूआरएल लॉन्च नहीं कर सकते'), findsOneWidget); + + await tester.binding.setLocale('fr', 'CA'); + await tester.pump(); + expect(find.text("Impossible de lancer l'url"), findsOneWidget); + + await tester.binding.setLocale('de', 'DE'); + await tester.pump(); + expect(find.text('Kann die URL nicht starten'), findsOneWidget); + }, + ); + + testWidgets( + 'MaterialApp overrides MaterialLocalizations for all locales', + (WidgetTester tester) async { + final Key textKey = UniqueKey(); + + await tester.pumpWidget(buildFrame( + // Accept whatever locale we're given + localeResolutionCallback: + (Locale? locale, Iterable supportedLocales) => locale, + delegates: [ + const FooStreamChatLocalizationsDelegate( + supportedLanguage: 'allLanguages', + ), + ], + buildContent: (BuildContext context) { + // Should always be 'foo', no matter what the locale is + return Text( + StreamChatLocalizations.of(context)!.launchUrlError, + key: textKey, + ); + }, + )); + + expect(tester.widget(find.byKey(textKey)).data, 'foo'); + + await tester.binding.setLocale('zh', 'CN'); + await tester.pump(); + expect(find.text('foo'), findsOneWidget); + + await tester.binding.setLocale('de', 'DE'); + await tester.pump(); + expect(find.text('foo'), findsOneWidget); + }, + ); + + testWidgets( + 'MaterialApp overrides MaterialLocalizations for default locale', + (WidgetTester tester) async { + final Key textKey = UniqueKey(); + + await tester.pumpWidget(buildFrame( + delegates: [ + const FooStreamChatLocalizationsDelegate(), + ], + // supportedLocales not specified, so all locales resolve to 'en' + buildContent: (BuildContext context) => Text( + StreamChatLocalizations.of(context)!.launchUrlError, + key: textKey, + ), + )); + + // Unsupported locale '_' (the widget tester's default) resolves to 'en'. + expect(tester.widget(find.byKey(textKey)).data, 'foo'); + + // Unsupported locale 'zh' resolves to 'en'. + await tester.binding.setLocale('zh', 'CN'); + await tester.pump(); + expect(find.text('foo'), findsOneWidget); + + // Unsupported locale 'de' resolves to 'en'. + await tester.binding.setLocale('de', 'DE'); + await tester.pump(); + expect(find.text('foo'), findsOneWidget); + }, + ); +} diff --git a/packages/stream_chat_localizations/test/stream_chat_localization_test.dart b/packages/stream_chat_localizations/test/stream_chat_localization_test.dart deleted file mode 100644 index 0324dd17..00000000 --- a/packages/stream_chat_localizations/test/stream_chat_localization_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter_test/flutter_test.dart'; - -import 'package:stream_chat_localizations/stream_chat_localizations.dart'; - -void main() { - for (final language in kStreamChatSupportedLanguages) { - test('translations exist for $language', () async { - final locale = Locale(language); - expect( - GlobalStreamChatLocalizations.delegate.isSupported(locale), - isTrue, - ); - final localizations = - await GlobalStreamChatLocalizations.delegate.load(locale); - expect(localizations.launchUrlError, isNotNull); - }); - } -} diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart new file mode 100644 index 00000000..6e796d08 --- /dev/null +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -0,0 +1,164 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; + +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; + +void main() { + for (final language in kStreamChatSupportedLanguages) { + test('translations exist for $language', () async { + final locale = Locale(language); + expect( + GlobalStreamChatLocalizations.delegate.isSupported(locale), isTrue); + final localizations = + await GlobalStreamChatLocalizations.delegate.load(locale); + expect(localizations.launchUrlError, isNotNull); + expect(localizations.loadingUsersError, isNotNull); + expect(localizations.noUsersLabel, isNotNull); + expect(localizations.retryLabel, isNotNull); + expect(localizations.userLastOnlineText, isNotNull); + expect(localizations.userOnlineText, isNotNull); + expect(localizations.userOnlineText, isNotNull); + // no users + expect(localizations.userTypingText([]), isNotNull); + // single user + expect(localizations.userTypingText([User(id: 'test-id')]), isNotNull); + // multiple users + expect( + localizations.userTypingText([ + User(id: 'test-id-1'), + User(id: 'test-id-2'), + ]), + isNotNull, + ); + expect(localizations.threadReplyLabel, isNotNull); + expect(localizations.onlyVisibleToYouText, isNotNull); + expect(localizations.threadReplyCountText(3), isNotNull); + expect( + localizations.attachmentsUploadProgressText(remaining: 3, total: 10), + isNotNull, + ); + expect( + localizations.pinnedByUserText( + pinnedBy: User(id: 'pinned-by-user-id'), + currentUser: OwnUser(id: 'current-user-id'), + ), + isNotNull, + ); + expect(localizations.emptyMessagesText, isNotNull); + expect(localizations.genericErrorText, isNotNull); + expect(localizations.loadingMessagesError, isNotNull); + expect(localizations.resultCountText(3), isNotNull); + expect(localizations.messageDeletedText, isNotNull); + expect(localizations.messageDeletedLabel, isNotNull); + expect(localizations.messageReactionsText, isNotNull); + expect(localizations.emptyChatMessagesText, isNotNull); + expect(localizations.threadSeparatorText(3), isNotNull); + expect(localizations.connectedLabel, isNotNull); + expect(localizations.disconnectedLabel, isNotNull); + expect(localizations.reconnectingLabel, isNotNull); + expect(localizations.alsoSendAsDirectMessageLabel, isNotNull); + expect(localizations.addACommentOrSendLabel, isNotNull); + expect(localizations.searchGifLabel, isNotNull); + expect(localizations.writeAMessageLabel, isNotNull); + expect(localizations.instantCommandsLabel, isNotNull); + expect(localizations.fileTooLargeAfterCompressionError, isNotNull); + expect(localizations.fileTooLargeError, isNotNull); + expect(localizations.emojiMatchingQueryText('sahil'), isNotNull); + expect(localizations.addAFileLabel, isNotNull); + expect(localizations.photoFromCameraLabel, isNotNull); + expect(localizations.uploadAFileLabel, isNotNull); + expect(localizations.uploadAPhotoLabel, isNotNull); + expect(localizations.uploadAVideoLabel, isNotNull); + expect(localizations.videoFromCameraLabel, isNotNull); + expect(localizations.okLabel, isNotNull); + expect(localizations.somethingWentWrongLabel, isNotNull); + expect(localizations.addMoreFilesLabel, isNotNull); + expect(localizations.enablePhotoAndVideoAccessMessage, isNotNull); + expect(localizations.allowGalleryAccessMessage, isNotNull); + expect(localizations.flagMessageLabel, isNotNull); + expect(localizations.flagMessageQuestion, isNotNull); + expect(localizations.flagLabel, isNotNull); + expect(localizations.cancelLabel, isNotNull); + expect(localizations.flagMessageSuccessfulLabel, isNotNull); + expect(localizations.flagMessageSuccessfulText, isNotNull); + expect(localizations.deleteLabel, isNotNull); + expect(localizations.deleteMessageLabel, isNotNull); + expect(localizations.deleteMessageQuestion, isNotNull); + expect(localizations.operationCouldNotBeCompletedText, isNotNull); + expect(localizations.replyLabel, isNotNull); + // pinned + expect(localizations.togglePinUnpinText(pinned: true), isNotNull); + // un-pinned + expect(localizations.togglePinUnpinText(pinned: false), isNotNull); + // delete-failed + expect( + localizations.toggleDeleteRetryDeleteMessageText(isDeleteFailed: true), + isNotNull, + ); + // first-delete + expect( + localizations.toggleDeleteRetryDeleteMessageText(isDeleteFailed: false), + isNotNull, + ); + expect(localizations.copyMessageLabel, isNotNull); + expect(localizations.editMessageLabel, isNotNull); + // resend-failed + expect( + localizations.toggleResendOrResendEditedMessage(isUpdateFailed: true), + isNotNull, + ); + // first resend + expect( + localizations.toggleResendOrResendEditedMessage(isUpdateFailed: false), + isNotNull, + ); + expect(localizations.photosLabel, isNotNull); + expect( + localizations.sentAtText( + date: DateTime.now(), + time: DateTime.now(), + ), + isNotNull, + ); + expect(localizations.todayLabel, isNotNull); + expect(localizations.yesterdayLabel, isNotNull); + expect(localizations.channelIsMutedText, isNotNull); + expect(localizations.noTitleText, isNotNull); + expect(localizations.letsStartChattingLabel, isNotNull); + expect(localizations.sendingFirstMessageLabel, isNotNull); + expect(localizations.startAChatLabel, isNotNull); + expect(localizations.loadingChannelsError, isNotNull); + expect(localizations.deleteConversationQuestion, isNotNull); + expect(localizations.streamChatLabel, isNotNull); + expect(localizations.searchingForNetworkLabel, isNotNull); + expect(localizations.offlineLabel, isNotNull); + expect(localizations.tryAgainLabel, isNotNull); + // 1 member + expect(localizations.membersCountText(1), isNotNull); + // 3 members + expect(localizations.membersCountText(3), isNotNull); + // 1 member + expect(localizations.watchersCountText(1), isNotNull); + // 3 members + expect(localizations.watchersCountText(3), isNotNull); + expect(localizations.viewInfoLabel, isNotNull); + expect(localizations.leaveGroupLabel, isNotNull); + expect(localizations.leaveLabel, isNotNull); + expect(localizations.leaveConversationLabel, isNotNull); + expect(localizations.leaveConversationQuestion, isNotNull); + expect(localizations.showInChatLabel, isNotNull); + expect(localizations.saveVideoLabel, isNotNull); + expect(localizations.uploadErrorLabel, isNotNull); + expect(localizations.giphyLabel, isNotNull); + expect(localizations.shuffleLabel, isNotNull); + expect(localizations.sendLabel, isNotNull); + expect(localizations.withText, isNotNull); + expect(localizations.inText, isNotNull); + expect(localizations.youText, isNotNull); + expect(localizations.ofText, isNotNull); + expect(localizations.fileText, isNotNull); + expect(localizations.replyToMessageLabel, isNotNull); + }); + } +} From 3e552ab4f62db9fd8d54a68db97e3faa68ac0413 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 17:18:51 +0530 Subject: [PATCH 20/35] chore(ui, localization): add doc-comments Signed-off-by: xsahil03x --- .../stream_chat_flutter/example/lib/main.dart | 1 - .../lib/src/channel_info.dart | 2 +- .../lib/src/channel_list_header.dart | 2 +- .../lib/src/extension.dart | 2 + .../stream_chat_localizations.dart | 2 +- .../lib/src/localization/translations.dart | 120 +++++++++++++++++- .../lib/src/message_actions_modal.dart | 2 +- .../lib/src/message_input.dart | 2 +- .../lib/src/message_reactions_modal.dart | 2 +- .../src/attachment_actions_modal_test.dart | 1 - .../lib/src/stream_chat_localizations.dart | 15 ++- .../lib/src/stream_chat_localizations_en.dart | 6 +- .../lib/src/stream_chat_localizations_fr.dart | 13 +- .../lib/src/stream_chat_localizations_hi.dart | 6 +- .../lib/src/stream_chat_localizations_it.dart | 10 +- .../test/translations_test.dart | 6 +- 16 files changed, 153 insertions(+), 39 deletions(-) diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index b340ac28..c2663a6a 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -1,7 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_localizations/stream_chat_localizations.dart'; diff --git a/packages/stream_chat_flutter/lib/src/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel_info.dart index 4e860745..e4226b72 100644 --- a/packages/stream_chat_flutter/lib/src/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel_info.dart @@ -116,7 +116,7 @@ class ChannelInfo extends StatelessWidget { ), const SizedBox(width: 10), Text( - context.translations.searchingForNetworkLabel, + context.translations.searchingForNetworkText, style: textStyle, ), ], diff --git a/packages/stream_chat_flutter/lib/src/channel_list_header.dart b/packages/stream_chat_flutter/lib/src/channel_list_header.dart index 6ef3ba10..3c7024ed 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_header.dart @@ -226,7 +226,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { ), const SizedBox(width: 10), Text( - context.translations.searchingForNetworkLabel, + context.translations.searchingForNetworkText, style: StreamChatTheme.of(context) .channelListHeaderTheme .title diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index 5d67ee50..b975941e 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -106,6 +106,8 @@ extension BuildContextX on BuildContext { double get textScaleFactor => MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0; + /// Retrieves current translations according to locale + /// Defaults to [DefaultTranslations] Translations get translations => StreamChatLocalizations.of(this) ?? DefaultTranslations.instance; } diff --git a/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart b/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart index b2a1bd5e..e9f8cf4b 100644 --- a/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/stream_chat_localizations.dart @@ -7,7 +7,7 @@ import 'package:stream_chat_flutter/src/localization/translations.dart' /// /// See also: /// -/// * [GlobalStreamChatLocalizations], which provides material localizations +/// * [GlobalStreamChatLocalizations], which provides stream chat localizations /// for many languages. abstract class StreamChatLocalizations implements Translations { /// The `StreamChatLocalizations` from the closest [Localizations] instance diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 6a7ac657..17355b6f 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -1,208 +1,316 @@ import 'package:jiffy/jiffy.dart'; +import 'package:stream_chat_flutter/src/connection_status_builder.dart'; +import 'package:stream_chat_flutter/src/message_input.dart'; +import 'package:stream_chat_flutter/src/message_list_view.dart'; +import 'package:stream_chat_flutter/src/message_search_list_view.dart'; import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart' show User; +/// Translation strings for the stream chat widgets abstract class Translations { + /// The error shown when [launchURL] fails String get launchUrlError; + /// The error shown when loading users fails String get loadingUsersError; + /// The label for "retry" button String get retryLabel; + /// The label for showing no users String get noUsersLabel; + /// The text for showing user is online String get userOnlineText; + /// The text for showing the last online of the user String get userLastOnlineText; + /// The text shown when [users] starts typing String userTypingText(Iterable users); + /// The label for "thread reply" String get threadReplyLabel; + /// The text for showing if the message is only visible to you String get onlyVisibleToYouText; + /// The text for showing the thread reply count String threadReplyCountText(int count); + /// The text for showing the attachments upload progress String attachmentsUploadProgressText({ required int remaining, required int total, }); + /// The text for showing who pinned the message String pinnedByUserText({ required User pinnedBy, required User currentUser, }); + /// The text for showing there are empty messages String get emptyMessagesText; + /// The text for showing generic error String get genericErrorText; + /// The error shown when loading messages fails String get loadingMessagesError; + /// The text for showing the result count in [MessageSearchListView] String resultCountText(int count); + /// The text for showing the message is deleted String get messageDeletedText; + /// The label for message deleted String get messageDeletedLabel; - String get messageReactionsText; + /// The label for message reactions + String get messageReactionsLabel; + /// The text for showing there are no chats String get emptyChatMessagesText; + /// The text for showing the thread separator in case [MessageListView] + /// contains a parent message String threadSeparatorText(int replyCount); + /// The label for "connected" in [ConnectionStatusBuilder] String get connectedLabel; + /// The label for "disconnected" in [ConnectionStatusBuilder] String get disconnectedLabel; + /// The label for "reconnecting" in [ConnectionStatusBuilder] String get reconnectingLabel; + /// The label for also send as direct message "checkbox"" in [MessageInput] String get alsoSendAsDirectMessageLabel; + /// The label for search Gif String get searchGifLabel; + /// The label for add a comment or send in case of + /// attachments inside [MessageInput] String get addACommentOrSendLabel; + /// The label for write a message in [MessageInput] String get writeAMessageLabel; + /// The label for instant commands in [MessageInput] String get instantCommandsLabel; + /// The error shown in case the fi"le is too large even after compression + /// while uploading via [MessageInput] String fileTooLargeAfterCompressionError(double limitInMB); + /// The error shown in case the file is too large + /// while uploading via [MessageInput] String fileTooLargeError(double limitInMB); + /// The text for showing the query while searching for emojis String emojiMatchingQueryText(String query); + /// The label for "add a file" String get addAFileLabel; + /// The label for "upload a photo" String get uploadAPhotoLabel; + /// The label for "upload a video" String get uploadAVideoLabel; + /// The label for "photo from camera" String get photoFromCameraLabel; + /// The label for "video from camera" String get videoFromCameraLabel; + /// The label for "upload a file" String get uploadAFileLabel; - String get somethingWentWrongLabel; + /// The error shown when something went wrong + String get somethingWentWrongError; + /// The label for "OK" String get okLabel; + /// The label for "add more files" String get addMoreFilesLabel; + /// The message shown for asking photo and video access permission String get enablePhotoAndVideoAccessMessage; + /// The message shown for asking gallery access permission String get allowGalleryAccessMessage; + /// The label for "flag message" String get flagMessageLabel; + /// The question asked while showing flag message dialog String get flagMessageQuestion; + /// The label for "Flag" String get flagLabel; + /// The label for "Cancel" String get cancelLabel; + /// The label for successful message flag String get flagMessageSuccessfulLabel; + /// The text for showing the message if successfully flagged String get flagMessageSuccessfulText; + /// The label for "delete message" String get deleteMessageLabel; + /// The question asked while showing delete message dialog String get deleteMessageQuestion; + /// The label for "Delete" String get deleteLabel; + /// The text for showing the operation could not be completed String get operationCouldNotBeCompletedText; + /// The label for "Reply" String get replyLabel; + /// The text for showing pin/un-pin functionality in [MessageWidget] + /// based on [pinned] String togglePinUnpinText({required bool pinned}); + /// The text for showing delete/retry-delete based on [isDeleteFailed] String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}); + /// The label for "copy message" String get copyMessageLabel; + /// The label for "edit message" String get editMessageLabel; + /// The text for showing resend/resend-edited message + /// based on [isUpdateFailed] String toggleResendOrResendEditedMessage({required bool isUpdateFailed}); + /// The label for "Photos" String get photosLabel; + /// The text for showing on which [date] and [time] the message was sent String sentAtText({required DateTime date, required DateTime time}); + /// The label for "Today" String get todayLabel; + /// The label for "Yesterday" String get yesterdayLabel; + /// The text for showing the channel is muted String get channelIsMutedText; + /// The text for showing there is no title String get noTitleText; + /// The label for "let's start chatting" String get letsStartChattingLabel; + /// The label for sending the first message String get sendingFirstMessageLabel; + /// The label for "start a chat" String get startAChatLabel; + /// The error shown when loading channel fails String get loadingChannelsError; + /// The label for "Delete conversation" String get deleteConversationLabel; + /// The question asked while showing delete conversation dialog String get deleteConversationQuestion; + /// The label for "Stream Chat" String get streamChatLabel; - String get searchingForNetworkLabel; + /// The text for showing searching for network + String get searchingForNetworkText; + /// The label for "Offline" String get offlineLabel; + /// The label for "Try again" String get tryAgainLabel; + /// The text for showing the members count based on [count] String membersCountText(int count); + /// The text for showing the watchers count based on [count] String watchersCountText(int count); + /// The label for "View Info" String get viewInfoLabel; + /// The label for "Leave Group" String get leaveGroupLabel; + /// The label for "Leave" String get leaveLabel; + /// The label for "Leave conversation" String get leaveConversationLabel; + /// The question asked while showing leave conversation dialog String get leaveConversationQuestion; + /// The label for "Show in chat" String get showInChatLabel; + /// The label for "Save Image" String get saveImageLabel; + /// The label for "Save Video" String get saveVideoLabel; + /// The label for "Upload Error" String get uploadErrorLabel; + /// The label for "Giphy" String get giphyLabel; + /// The label for "Shuffle" String get shuffleLabel; + /// The label for "Send" String get sendLabel; + /// The label for "With" String get withText; + /// The text shown for "In" String get inText; + /// The text shown for "You" String get youText; + /// The text shown for "Of" String get ofText; + /// The text shown for "File" String get fileText; + /// The label for "Reply to message" String get replyToMessageLabel; } +/// Default implementation of Translation strings for the stream chat widgets class DefaultTranslations implements Translations { const DefaultTranslations._(); + /// Singleton instance of [DefaultTranslations] static const instance = DefaultTranslations._(); @override @@ -278,7 +386,7 @@ class DefaultTranslations implements Translations { String get messageDeletedLabel => 'Message deleted'; @override - String get messageReactionsText => 'Message Reactions'; + String get messageReactionsLabel => 'Message Reactions'; @override String get emptyChatMessagesText => 'No chats here yet...'; @@ -348,7 +456,7 @@ class DefaultTranslations implements Translations { String get okLabel => 'OK'; @override - String get somethingWentWrongLabel => 'Something went wrong'; + String get somethingWentWrongError => 'Something went wrong'; @override String get addMoreFilesLabel => 'Add more files'; @@ -479,7 +587,7 @@ class DefaultTranslations implements Translations { String get streamChatLabel => 'Stream Chat'; @override - String get searchingForNetworkLabel => 'Searching for Network'; + String get searchingForNetworkText => 'Searching for Network'; @override String get offlineLabel => 'Offline...'; diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart index 3e0afe75..2e9659fa 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart @@ -365,7 +365,7 @@ class _MessageActionsModalState extends State { size: 24, ), details: context.translations.operationCouldNotBeCompletedText, - title: context.translations.somethingWentWrongLabel, + title: context.translations.somethingWentWrongError, okText: context.translations.okLabel, ); } diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 7843e77e..feb5bd6d 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -2121,7 +2121,7 @@ class MessageInputState extends State { height: 26, ), Text( - context.translations.somethingWentWrongLabel, + context.translations.somethingWentWrongError, style: _streamChatTheme.textTheme.headlineBold, ), const SizedBox( diff --git a/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart b/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart index 7926dcab..9bd518ce 100644 --- a/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart @@ -155,7 +155,7 @@ class MessageReactionsModal extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - context.translations.messageReactionsText, + context.translations.messageReactionsLabel, style: chatThemeData.textTheme.headlineBold, ), const SizedBox(height: 16), diff --git a/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart b/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart index 59a49ac7..3f210742 100644 --- a/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart +++ b/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart @@ -7,7 +7,6 @@ import 'package:stream_chat_flutter/src/attachment_actions_modal.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'mocks.dart'; -import 'package:stream_chat_flutter/src/extension.dart'; class MockAttachmentDownloader extends Mock { ProgressCallback? progressCallback; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart index d0b1f6dc..bb2d791f 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations.dart @@ -6,8 +6,11 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart' show StreamChatLocalizations, User; part 'stream_chat_localizations_en.dart'; + part 'stream_chat_localizations_fr.dart'; + part 'stream_chat_localizations_it.dart'; + part 'stream_chat_localizations_hi.dart'; /// The set of supported languages, as language code strings. @@ -28,8 +31,8 @@ const kStreamChatSupportedLanguages = { /// Creates a [GlobalStreamChatLocalizations] instance for the given `locale`. /// /// All of the function's arguments except `locale` will be passed to the -/// [GlobalStreamChatLocalizations] constructor. (The `localeName` argument of that -/// constructor is specified by the actual subclass constructor by this +/// [GlobalStreamChatLocalizations] constructor. (The `localeName` argument +/// of that constructor is specified by the actual subclass constructor by this /// function.) /// /// The following locales are supported by this package: @@ -92,13 +95,15 @@ abstract class GlobalStreamChatLocalizations required String localeName, }) : _localeName = localeName; + // ignore: unused_field final String _localeName; /// A [LocalizationsDelegate] for [StreamChatLocalizations]. /// - /// Most internationalized apps will use [GlobalStreamChatLocalizations.delegates] - /// as the value of [MaterialApp.localizationsDelegates] to include - /// the localizations for both the flutter and stream chat widget libraries. + /// Most internationalized apps will use + /// [GlobalStreamChatLocalizations.delegates] as the value of + /// [MaterialApp.localizationsDelegates] to include the localizations for both + /// the flutter and stream chat widget libraries. static const LocalizationsDelegate delegate = _StreamChatLocalizationsDelegate(); diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index ba515e2f..ad58b89a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -79,7 +79,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get messageDeletedLabel => 'Message deleted'; @override - String get messageReactionsText => 'Message Reactions'; + String get messageReactionsLabel => 'Message Reactions'; @override String get emptyChatMessagesText => 'No chats here yet...'; @@ -149,7 +149,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get okLabel => 'OK'; @override - String get somethingWentWrongLabel => 'Something went wrong'; + String get somethingWentWrongError => 'Something went wrong'; @override String get addMoreFilesLabel => 'Add more files'; @@ -280,7 +280,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get streamChatLabel => 'Stream Chat'; @override - String get searchingForNetworkLabel => 'Searching for Network'; + String get searchingForNetworkText => 'Searching for Network'; @override String get offlineLabel => 'Offline...'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index 297fbc1a..ba8511a0 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -1,6 +1,6 @@ part of 'stream_chat_localizations.dart'; -/// The translations for English (`fr`). +/// The translations for French (`fr`). class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for French. const StreamChatLocalizationsFr({String localeName = 'fr'}) @@ -42,7 +42,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { @override String threadReplyCountText(int count) => - "$count Réponses au fil de discussion"; + '$count Réponses au fil de discussion'; @override String attachmentsUploadProgressText({ @@ -80,7 +80,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { String get messageDeletedLabel => 'Message supprimé'; @override - String get messageReactionsText => 'Réactions aux messages'; + String get messageReactionsLabel => 'Réactions aux messages'; @override String get emptyChatMessagesText => 'Pas encore de chats ici...'; @@ -124,7 +124,8 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { @override String fileTooLargeError(double limitInMB) => - 'Le fichier est trop volumineux pour être téléchargé. La taille limite du fichier est de $limitInMB Mo.'; + 'Le fichier est trop volumineux pour être téléchargé. ' + 'La taille limite du fichier est de $limitInMB Mo.'; @override String emojiMatchingQueryText(String query) => @@ -152,7 +153,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { String get okLabel => 'OK'; @override - String get somethingWentWrongLabel => 'Quelque chose a mal tourné'; + String get somethingWentWrongError => 'Quelque chose a mal tourné'; @override String get addMoreFilesLabel => "Ajouter d'autres fichiers"; @@ -283,7 +284,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { String get streamChatLabel => 'Stream Chat'; @override - String get searchingForNetworkLabel => 'Recherche de réseau'; + String get searchingForNetworkText => 'Recherche de réseau'; @override String get offlineLabel => 'Hors ligne...'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index c6e94e32..93a5ca30 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -79,7 +79,7 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { String get messageDeletedLabel => 'संदेश हटाये'; @override - String get messageReactionsText => 'संदेश प्रतिक्रियाएं'; + String get messageReactionsLabel => 'संदेश प्रतिक्रियाएं'; @override String get emptyChatMessagesText => 'यहां अभी तक कोई चैट नहीं...'; @@ -149,7 +149,7 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { String get okLabel => 'ठीक'; @override - String get somethingWentWrongLabel => 'लोड करने में समस्या'; + String get somethingWentWrongError => 'लोड करने में समस्या'; @override String get addMoreFilesLabel => 'और फ़ाइलें जोड़ें'; @@ -279,7 +279,7 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { String get streamChatLabel => 'स्ट्रीम चैट'; @override - String get searchingForNetworkLabel => 'नेटवर्क खोज रहे हैं'; + String get searchingForNetworkText => 'नेटवर्क खोज रहे हैं'; @override String get offlineLabel => 'ऑफलाइन...'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index 8797de27..ce5faf55 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -1,8 +1,8 @@ part of 'stream_chat_localizations.dart'; -/// The translations for English (`hi`). +/// The translations for Italian (`it`). class StreamChatLocalizationsIt extends GlobalStreamChatLocalizations { - /// Create an instance of the translation bundle for Hindi. + /// Create an instance of the translation bundle for Italian. const StreamChatLocalizationsIt({String localeName = 'it'}) : super(localeName: localeName); @@ -80,7 +80,7 @@ class StreamChatLocalizationsIt extends GlobalStreamChatLocalizations { String get messageDeletedLabel => 'Messaggio cancellato'; @override - String get messageReactionsText => 'Reazioni al messaggio'; + String get messageReactionsLabel => 'Reazioni al messaggio'; @override String get emptyChatMessagesText => 'Nessuna conversazione al momento...'; @@ -151,7 +151,7 @@ Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; String get okLabel => 'Ok'; @override - String get somethingWentWrongLabel => 'Qualcosa è andato storto'; + String get somethingWentWrongError => 'Qualcosa è andato storto'; @override String get addMoreFilesLabel => 'Aggiungi altri file'; @@ -281,7 +281,7 @@ Inviato il ${_getDay(date)} alle ${Jiffy(time.toLocal()).format('HH:mm')}'''; String get streamChatLabel => 'Stream Chat'; @override - String get searchingForNetworkLabel => 'Cercando una connessione'; + String get searchingForNetworkText => 'Cercando una connessione'; @override String get offlineLabel => 'Offline...'; diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 6e796d08..31471406 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -51,7 +51,7 @@ void main() { expect(localizations.resultCountText(3), isNotNull); expect(localizations.messageDeletedText, isNotNull); expect(localizations.messageDeletedLabel, isNotNull); - expect(localizations.messageReactionsText, isNotNull); + expect(localizations.messageReactionsLabel, isNotNull); expect(localizations.emptyChatMessagesText, isNotNull); expect(localizations.threadSeparatorText(3), isNotNull); expect(localizations.connectedLabel, isNotNull); @@ -72,7 +72,7 @@ void main() { expect(localizations.uploadAVideoLabel, isNotNull); expect(localizations.videoFromCameraLabel, isNotNull); expect(localizations.okLabel, isNotNull); - expect(localizations.somethingWentWrongLabel, isNotNull); + expect(localizations.somethingWentWrongError, isNotNull); expect(localizations.addMoreFilesLabel, isNotNull); expect(localizations.enablePhotoAndVideoAccessMessage, isNotNull); expect(localizations.allowGalleryAccessMessage, isNotNull); @@ -131,7 +131,7 @@ void main() { expect(localizations.loadingChannelsError, isNotNull); expect(localizations.deleteConversationQuestion, isNotNull); expect(localizations.streamChatLabel, isNotNull); - expect(localizations.searchingForNetworkLabel, isNotNull); + expect(localizations.searchingForNetworkText, isNotNull); expect(localizations.offlineLabel, isNotNull); expect(localizations.tryAgainLabel, isNotNull); // 1 member From 37a81ebb88759dc627a996362e576d2582f10bdb Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 17:46:28 +0530 Subject: [PATCH 21/35] test(localization): add remaining tests Signed-off-by: xsahil03x --- .../test/translations_test.dart | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 31471406..571fec29 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -161,4 +161,25 @@ void main() { expect(localizations.replyToMessageLabel, isNotNull); }); } + + test('should throw if try to load locale which is not supported', () async { + const locale = Locale('not-supported-locale'); + expect( + GlobalStreamChatLocalizations.delegate.isSupported(locale), + isFalse, + ); + try { + await GlobalStreamChatLocalizations.delegate.load(locale); + } catch (e) { + expect(e, isA()); + } + }); + + test('`.toString`', () { + final supportedLocales = kStreamChatSupportedLanguages; + expect( + GlobalStreamChatLocalizations.delegate.toString(), + 'GlobalStreamChatLocalizations.delegate($supportedLocales locales)', + ); + }); } From a1189162631f3aeb79e680504f4a1be609473f63 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 17:50:37 +0530 Subject: [PATCH 22/35] chore(localization): fix analysis error Signed-off-by: xsahil03x --- packages/stream_chat_localizations/test/translations_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 571fec29..04b25e5e 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -176,7 +176,7 @@ void main() { }); test('`.toString`', () { - final supportedLocales = kStreamChatSupportedLanguages; + const supportedLocales = kStreamChatSupportedLanguages; expect( GlobalStreamChatLocalizations.delegate.toString(), 'GlobalStreamChatLocalizations.delegate($supportedLocales locales)', From f1133dd4b0253a31577cc0eb7760ec17f27976df Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 18:02:17 +0530 Subject: [PATCH 23/35] test(localization): fix `.toString` test Signed-off-by: xsahil03x --- packages/stream_chat_localizations/test/translations_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 04b25e5e..81acf58f 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -176,7 +176,7 @@ void main() { }); test('`.toString`', () { - const supportedLocales = kStreamChatSupportedLanguages; + final supportedLocales = kStreamChatSupportedLanguages.length; expect( GlobalStreamChatLocalizations.delegate.toString(), 'GlobalStreamChatLocalizations.delegate($supportedLocales locales)', From 5f6f891eac25d9d731d608a7196fe121d1967624 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 18:02:37 +0530 Subject: [PATCH 24/35] chore(repo): update melos for localization Signed-off-by: xsahil03x --- melos.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/melos.yaml b/melos.yaml index 6232c3fa..b645deb0 100644 --- a/melos.yaml +++ b/melos.yaml @@ -13,7 +13,7 @@ scripts: analyze: run: | - melos exec -c 4 --ignore="*example*" -- \ + melos exec -c 5 --ignore="*example*" -- \ dart analyze --fatal-infos . description: | Run `dart analyze` in all packages. @@ -26,7 +26,7 @@ scripts: lint:pub: run: | - melos exec -c 4 --no-private --ignore="*example*" -- \ + melos exec -c 5 --no-private --ignore="*example*" -- \ pub publish --dry-run description: | Run `pub publish --dry-run` in all packages. @@ -56,7 +56,7 @@ scripts: dir-exists: test test:flutter: - run: melos exec -c 3 --fail-fast -- "flutter test --coverage" + run: melos exec -c 4 --fail-fast -- "flutter test --coverage" description: Run Flutter tests for a specific package in this project. select-package: flutter: true @@ -64,7 +64,7 @@ scripts: coverage:ignore-file: run: | - melos exec -c 4 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh" + melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh" description: Removes all the ignored files from the coverage report. select-package: dir-exists: coverage From af0356e5a15afbbd00ff2f5e78a8d142d59eb154 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 19:47:54 +0530 Subject: [PATCH 25/35] test(localization): fix `sentAtText`, add remaining tests Signed-off-by: xsahil03x --- .../lib/src/localization/translations.dart | 13 +- .../test/src/default_translations_test.dart | 174 ++++++++++++++++++ .../lib/src/stream_chat_localizations_en.dart | 13 +- .../lib/src/stream_chat_localizations_fr.dart | 13 +- .../lib/src/stream_chat_localizations_hi.dart | 13 +- .../lib/src/stream_chat_localizations_it.dart | 17 +- .../test/translations_test.dart | 19 ++ 7 files changed, 235 insertions(+), 27 deletions(-) create mode 100644 packages/stream_chat_flutter/test/src/default_translations_test.dart diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 17355b6f..d6e5add0 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -535,15 +535,18 @@ class DefaultTranslations implements Translations { String get photosLabel => 'Photos'; String _getDay(DateTime dateTime) { - final now = Jiffy(DateTime.now()); - final date = Jiffy(dateTime); + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final yesterday = DateTime(now.year, now.month, now.day - 1); - if (date.isSame(now, Units.DAY)) { + final date = DateTime(dateTime.year, dateTime.month, dateTime.day); + + if (date == today) { return 'today'; - } else if (now.diff(date, Units.HOUR) < 24) { + } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${date.MMMd}'; + return 'on ${Jiffy(date).MMMd}'; } } diff --git a/packages/stream_chat_flutter/test/src/default_translations_test.dart b/packages/stream_chat_flutter/test/src/default_translations_test.dart new file mode 100644 index 00000000..60e69fab --- /dev/null +++ b/packages/stream_chat_flutter/test/src/default_translations_test.dart @@ -0,0 +1,174 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; + +void main() { + test('Default translations should exist', () { + final translations = DefaultTranslations.instance; + expect(translations.launchUrlError, isNotNull); + expect(translations.loadingUsersError, isNotNull); + expect(translations.noUsersLabel, isNotNull); + expect(translations.retryLabel, isNotNull); + expect(translations.userLastOnlineText, isNotNull); + expect(translations.userOnlineText, isNotNull); + expect(translations.userOnlineText, isNotNull); + // no users + expect(translations.userTypingText([]), isNotNull); + // single user + expect(translations.userTypingText([User(id: 'test-id')]), isNotNull); + // multiple users + expect( + translations.userTypingText([ + User(id: 'test-id-1'), + User(id: 'test-id-2'), + ]), + isNotNull, + ); + expect(translations.threadReplyLabel, isNotNull); + expect(translations.onlyVisibleToYouText, isNotNull); + expect(translations.threadReplyCountText(3), isNotNull); + expect( + translations.attachmentsUploadProgressText(remaining: 3, total: 10), + isNotNull, + ); + expect( + translations.pinnedByUserText( + pinnedBy: User(id: 'pinned-by-user-id'), + currentUser: OwnUser(id: 'current-user-id'), + ), + isNotNull, + ); + expect(translations.emptyMessagesText, isNotNull); + expect(translations.genericErrorText, isNotNull); + expect(translations.loadingMessagesError, isNotNull); + expect(translations.resultCountText(3), isNotNull); + expect(translations.messageDeletedText, isNotNull); + expect(translations.messageDeletedLabel, isNotNull); + expect(translations.messageReactionsLabel, isNotNull); + expect(translations.emptyChatMessagesText, isNotNull); + expect(translations.threadSeparatorText(3), isNotNull); + expect(translations.connectedLabel, isNotNull); + expect(translations.disconnectedLabel, isNotNull); + expect(translations.reconnectingLabel, isNotNull); + expect(translations.alsoSendAsDirectMessageLabel, isNotNull); + expect(translations.addACommentOrSendLabel, isNotNull); + expect(translations.searchGifLabel, isNotNull); + expect(translations.writeAMessageLabel, isNotNull); + expect(translations.instantCommandsLabel, isNotNull); + expect(translations.fileTooLargeAfterCompressionError, isNotNull); + expect(translations.fileTooLargeError, isNotNull); + expect(translations.emojiMatchingQueryText('sahil'), isNotNull); + expect(translations.addAFileLabel, isNotNull); + expect(translations.photoFromCameraLabel, isNotNull); + expect(translations.uploadAFileLabel, isNotNull); + expect(translations.uploadAPhotoLabel, isNotNull); + expect(translations.uploadAVideoLabel, isNotNull); + expect(translations.videoFromCameraLabel, isNotNull); + expect(translations.okLabel, isNotNull); + expect(translations.somethingWentWrongError, isNotNull); + expect(translations.addMoreFilesLabel, isNotNull); + expect(translations.enablePhotoAndVideoAccessMessage, isNotNull); + expect(translations.allowGalleryAccessMessage, isNotNull); + expect(translations.flagMessageLabel, isNotNull); + expect(translations.flagMessageQuestion, isNotNull); + expect(translations.flagLabel, isNotNull); + expect(translations.cancelLabel, isNotNull); + expect(translations.flagMessageSuccessfulLabel, isNotNull); + expect(translations.flagMessageSuccessfulText, isNotNull); + expect(translations.deleteLabel, isNotNull); + expect(translations.deleteMessageLabel, isNotNull); + expect(translations.deleteMessageQuestion, isNotNull); + expect(translations.operationCouldNotBeCompletedText, isNotNull); + expect(translations.replyLabel, isNotNull); + // pinned + expect(translations.togglePinUnpinText(pinned: true), isNotNull); + // un-pinned + expect(translations.togglePinUnpinText(pinned: false), isNotNull); + // delete-failed + expect( + translations.toggleDeleteRetryDeleteMessageText(isDeleteFailed: true), + isNotNull, + ); + // first-delete + expect( + translations.toggleDeleteRetryDeleteMessageText(isDeleteFailed: false), + isNotNull, + ); + expect(translations.copyMessageLabel, isNotNull); + expect(translations.editMessageLabel, isNotNull); + // resend-failed + expect( + translations.toggleResendOrResendEditedMessage(isUpdateFailed: true), + isNotNull, + ); + // first resend + expect( + translations.toggleResendOrResendEditedMessage(isUpdateFailed: false), + isNotNull, + ); + expect(translations.photosLabel, isNotNull); + // today + expect( + translations.sentAtText( + date: DateTime.now(), + time: DateTime.now(), + ), + isNotNull, + ); + // yesterday + expect( + translations.sentAtText( + date: DateTime.now().subtract(const Duration(days: 1)), + time: DateTime.now(), + ), + isNotNull, + ); + // any other day + expect( + translations.sentAtText( + date: DateTime.now().subtract(const Duration(days: 3)), + time: DateTime.now(), + ), + isNotNull, + ); + expect(translations.todayLabel, isNotNull); + expect(translations.yesterdayLabel, isNotNull); + expect(translations.channelIsMutedText, isNotNull); + expect(translations.noTitleText, isNotNull); + expect(translations.letsStartChattingLabel, isNotNull); + expect(translations.sendingFirstMessageLabel, isNotNull); + expect(translations.startAChatLabel, isNotNull); + expect(translations.loadingChannelsError, isNotNull); + expect(translations.deleteConversationLabel, isNotNull); + expect(translations.deleteConversationQuestion, isNotNull); + expect(translations.streamChatLabel, isNotNull); + expect(translations.searchingForNetworkText, isNotNull); + expect(translations.offlineLabel, isNotNull); + expect(translations.tryAgainLabel, isNotNull); + // 1 member + expect(translations.membersCountText(1), isNotNull); + // 3 members + expect(translations.membersCountText(3), isNotNull); + // 1 member + expect(translations.watchersCountText(1), isNotNull); + // 3 members + expect(translations.watchersCountText(3), isNotNull); + expect(translations.viewInfoLabel, isNotNull); + expect(translations.leaveGroupLabel, isNotNull); + expect(translations.leaveLabel, isNotNull); + expect(translations.leaveConversationLabel, isNotNull); + expect(translations.leaveConversationQuestion, isNotNull); + expect(translations.showInChatLabel, isNotNull); + expect(translations.saveImageLabel, isNotNull); + expect(translations.saveVideoLabel, isNotNull); + expect(translations.uploadErrorLabel, isNotNull); + expect(translations.giphyLabel, isNotNull); + expect(translations.shuffleLabel, isNotNull); + expect(translations.sendLabel, isNotNull); + expect(translations.withText, isNotNull); + expect(translations.inText, isNotNull); + expect(translations.youText, isNotNull); + expect(translations.ofText, isNotNull); + expect(translations.fileText, isNotNull); + expect(translations.replyToMessageLabel, isNotNull); + }); +} diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index ad58b89a..5041d398 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -228,15 +228,18 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get photosLabel => 'Photos'; String _getDay(DateTime dateTime) { - final now = Jiffy(DateTime.now()); - final date = Jiffy(dateTime); + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final yesterday = DateTime(now.year, now.month, now.day - 1); - if (date.isSame(now, Units.DAY)) { + final date = DateTime(dateTime.year, dateTime.month, dateTime.day); + + if (date == today) { return 'today'; - } else if (now.diff(date, Units.HOUR) < 24) { + } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${date.MMMd}'; + return 'on ${Jiffy(date).MMMd}'; } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index ba8511a0..1bbfbc5a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -232,15 +232,18 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { String get photosLabel => 'Photos'; String _getDay(DateTime dateTime) { - final now = Jiffy(DateTime.now()); - final date = Jiffy(dateTime); + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final yesterday = DateTime(now.year, now.month, now.day - 1); - if (date.isSame(now, Units.DAY)) { + final date = DateTime(dateTime.year, dateTime.month, dateTime.day); + + if (date == today) { return "aujourd'hui"; - } else if (now.diff(date, Units.HOUR) < 24) { + } else if (date == yesterday) { return 'hier'; } else { - return 'le ${date.MMMd}'; + return 'le ${Jiffy(date).MMMd}'; } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index 93a5ca30..850e481b 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -227,15 +227,18 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { String get photosLabel => 'तस्वीरें'; String _getDay(DateTime dateTime) { - final now = Jiffy(DateTime.now()); - final date = Jiffy(dateTime); + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final yesterday = DateTime(now.year, now.month, now.day - 1); - if (date.isSame(now, Units.DAY)) { + final date = DateTime(dateTime.year, dateTime.month, dateTime.day); + + if (date == today) { return 'आज'; - } else if (now.diff(date, Units.HOUR) < 24) { + } else if (date == yesterday) { return 'कल'; } else { - return '${date.MMMd} को'; + return '${Jiffy(date).MMMd} को'; } } diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index ce5faf55..8b2e1692 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -229,21 +229,24 @@ Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; String get photosLabel => 'Foto'; String _getDay(DateTime dateTime) { - final now = Jiffy(DateTime.now()); - final date = Jiffy(dateTime); + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final yesterday = DateTime(now.year, now.month, now.day - 1); - if (date.isSame(now, Units.DAY)) { + final date = DateTime(dateTime.year, dateTime.month, dateTime.day); + + if (date == today) { return 'oggi'; - } else if (now.diff(date, Units.HOUR) < 24) { + } else if (date == yesterday) { return 'ieri'; } else { - return 'il ${date.MMMd}'; + return 'il ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => ''' -Inviato il ${_getDay(date)} alle ${Jiffy(time.toLocal()).format('HH:mm')}'''; + String sentAtText({required DateTime date, required DateTime time}) => + "Inviato ${_getDay(date)} alle ${Jiffy(time.toLocal()).format('HH:mm')}"; @override String get todayLabel => 'Oggi'; diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 81acf58f..199557d8 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -114,6 +114,7 @@ void main() { isNotNull, ); expect(localizations.photosLabel, isNotNull); + // today expect( localizations.sentAtText( date: DateTime.now(), @@ -121,6 +122,22 @@ void main() { ), isNotNull, ); + // yesterday + expect( + localizations.sentAtText( + date: DateTime.now().subtract(const Duration(days: 1)), + time: DateTime.now(), + ), + isNotNull, + ); + // any other day + expect( + localizations.sentAtText( + date: DateTime.now().subtract(const Duration(days: 3)), + time: DateTime.now(), + ), + isNotNull, + ); expect(localizations.todayLabel, isNotNull); expect(localizations.yesterdayLabel, isNotNull); expect(localizations.channelIsMutedText, isNotNull); @@ -129,6 +146,7 @@ void main() { expect(localizations.sendingFirstMessageLabel, isNotNull); expect(localizations.startAChatLabel, isNotNull); expect(localizations.loadingChannelsError, isNotNull); + expect(localizations.deleteConversationLabel, isNotNull); expect(localizations.deleteConversationQuestion, isNotNull); expect(localizations.streamChatLabel, isNotNull); expect(localizations.searchingForNetworkText, isNotNull); @@ -148,6 +166,7 @@ void main() { expect(localizations.leaveConversationLabel, isNotNull); expect(localizations.leaveConversationQuestion, isNotNull); expect(localizations.showInChatLabel, isNotNull); + expect(localizations.saveImageLabel, isNotNull); expect(localizations.saveVideoLabel, isNotNull); expect(localizations.uploadErrorLabel, isNotNull); expect(localizations.giphyLabel, isNotNull); From 17ea43b9d99963079c2cc3824bb692c84cfd72b9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 19:55:23 +0530 Subject: [PATCH 26/35] test(localization): fix test Signed-off-by: xsahil03x --- .../test/translations_test.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 199557d8..ce00b9ac 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'package:stream_chat_localizations/stream_chat_localizations.dart'; +import 'package:stream_chat_localizations/src/stream_chat_localizations.dart'; void main() { for (final language in kStreamChatSupportedLanguages) { @@ -183,12 +182,8 @@ void main() { test('should throw if try to load locale which is not supported', () async { const locale = Locale('not-supported-locale'); - expect( - GlobalStreamChatLocalizations.delegate.isSupported(locale), - isFalse, - ); try { - await GlobalStreamChatLocalizations.delegate.load(locale); + getStreamChatTranslation(locale); } catch (e) { expect(e, isA()); } From 937f55e67b7ab6d3b7019d4116cf612667b819e9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 20:02:36 +0530 Subject: [PATCH 27/35] chore(ui): fix analysis error Signed-off-by: xsahil03x --- .../stream_chat_flutter/test/src/default_translations_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/test/src/default_translations_test.dart b/packages/stream_chat_flutter/test/src/default_translations_test.dart index 60e69fab..13941c2e 100644 --- a/packages/stream_chat_flutter/test/src/default_translations_test.dart +++ b/packages/stream_chat_flutter/test/src/default_translations_test.dart @@ -3,7 +3,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; void main() { test('Default translations should exist', () { - final translations = DefaultTranslations.instance; + const translations = DefaultTranslations.instance; expect(translations.launchUrlError, isNotNull); expect(translations.loadingUsersError, isNotNull); expect(translations.noUsersLabel, isNotNull); From 36a13e8a2b527fe95402908f2a1a186a912ae5a7 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 20:16:36 +0530 Subject: [PATCH 28/35] fix(localization): fix `fileTooLargeAfterCompressionError`, `fileTooLargeError` Signed-off-by: xsahil03x --- .../test/src/default_translations_test.dart | 4 ++-- .../stream_chat_localizations/test/translations_test.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/stream_chat_flutter/test/src/default_translations_test.dart b/packages/stream_chat_flutter/test/src/default_translations_test.dart index 13941c2e..e78c0115 100644 --- a/packages/stream_chat_flutter/test/src/default_translations_test.dart +++ b/packages/stream_chat_flutter/test/src/default_translations_test.dart @@ -54,8 +54,8 @@ void main() { expect(translations.searchGifLabel, isNotNull); expect(translations.writeAMessageLabel, isNotNull); expect(translations.instantCommandsLabel, isNotNull); - expect(translations.fileTooLargeAfterCompressionError, isNotNull); - expect(translations.fileTooLargeError, isNotNull); + expect(translations.fileTooLargeAfterCompressionError(33), isNotNull); + expect(translations.fileTooLargeError(33), isNotNull); expect(translations.emojiMatchingQueryText('sahil'), isNotNull); expect(translations.addAFileLabel, isNotNull); expect(translations.photoFromCameraLabel, isNotNull); diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index ce00b9ac..0e621159 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -61,8 +61,8 @@ void main() { expect(localizations.searchGifLabel, isNotNull); expect(localizations.writeAMessageLabel, isNotNull); expect(localizations.instantCommandsLabel, isNotNull); - expect(localizations.fileTooLargeAfterCompressionError, isNotNull); - expect(localizations.fileTooLargeError, isNotNull); + expect(localizations.fileTooLargeAfterCompressionError(33), isNotNull); + expect(localizations.fileTooLargeError(33), isNotNull); expect(localizations.emojiMatchingQueryText('sahil'), isNotNull); expect(localizations.addAFileLabel, isNotNull); expect(localizations.photoFromCameraLabel, isNotNull); From 9b759df8131e52dadb202d6187eacfc6a60b8d2f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jul 2021 16:55:46 +0530 Subject: [PATCH 29/35] chore(localization): add examples Signed-off-by: xsahil03x --- .../example/.gitignore | 41 ++ .../example/.metadata | 10 + .../example/README.md | 2 + .../example/android/.gitignore | 11 + .../example/android/app/build.gradle | 64 ++ .../android/app/src/debug/AndroidManifest.xml | 7 + .../android/app/src/main/AndroidManifest.xml | 47 ++ .../com/example/example/MainActivity.kt | 6 + .../main/res/drawable/launch_background.xml | 12 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 544 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 442 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 721 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 1031 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 1443 bytes .../app/src/main/res/values/styles.xml | 18 + .../app/src/profile/AndroidManifest.xml | 7 + .../example/android/build.gradle | 31 + .../example/android/gradle.properties | 4 + .../gradle/wrapper/gradle-wrapper.properties | 6 + .../example/android/settings.gradle | 11 + .../example/ios/.gitignore | 32 + .../ios/Runner.xcodeproj/project.pbxproj | 563 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../xcshareddata/xcschemes/Runner.xcscheme | 91 +++ .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../example/ios/Runner/AppDelegate.swift | 13 + .../AppIcon.appiconset/Contents.json | 122 ++++ .../Icon-App-1024x1024@1x.png | Bin 0 -> 10932 bytes .../AppIcon.appiconset/Icon-App-20x20@1x.png | Bin 0 -> 564 bytes .../AppIcon.appiconset/Icon-App-20x20@2x.png | Bin 0 -> 1283 bytes .../AppIcon.appiconset/Icon-App-20x20@3x.png | Bin 0 -> 1588 bytes .../AppIcon.appiconset/Icon-App-29x29@1x.png | Bin 0 -> 1025 bytes .../AppIcon.appiconset/Icon-App-29x29@2x.png | Bin 0 -> 1716 bytes .../AppIcon.appiconset/Icon-App-29x29@3x.png | Bin 0 -> 1920 bytes .../AppIcon.appiconset/Icon-App-40x40@1x.png | Bin 0 -> 1283 bytes .../AppIcon.appiconset/Icon-App-40x40@2x.png | Bin 0 -> 1895 bytes .../AppIcon.appiconset/Icon-App-40x40@3x.png | Bin 0 -> 2665 bytes .../AppIcon.appiconset/Icon-App-60x60@2x.png | Bin 0 -> 2665 bytes .../AppIcon.appiconset/Icon-App-60x60@3x.png | Bin 0 -> 3831 bytes .../AppIcon.appiconset/Icon-App-76x76@1x.png | Bin 0 -> 1888 bytes .../AppIcon.appiconset/Icon-App-76x76@2x.png | Bin 0 -> 3294 bytes .../Icon-App-83.5x83.5@2x.png | Bin 0 -> 3612 bytes .../LaunchImage.imageset/Contents.json | 23 + .../LaunchImage.imageset/LaunchImage.png | Bin 0 -> 68 bytes .../LaunchImage.imageset/LaunchImage@2x.png | Bin 0 -> 68 bytes .../LaunchImage.imageset/LaunchImage@3x.png | Bin 0 -> 68 bytes .../LaunchImage.imageset/README.md | 5 + .../Runner/Base.lproj/LaunchScreen.storyboard | 37 ++ .../ios/Runner/Base.lproj/Main.storyboard | 26 + .../example/ios/Runner/Info.plist | 45 ++ .../ios/Runner/Runner-Bridging-Header.h | 1 + .../example/lib/add_new_lang.dart | 500 ++++++++++++++++ .../example/lib/main.dart | 115 ++++ .../example/lib/override_lang.dart | 142 +++++ .../example/pubspec.yaml | 26 + 59 files changed, 2067 insertions(+) create mode 100644 packages/stream_chat_localizations/example/.gitignore create mode 100644 packages/stream_chat_localizations/example/.metadata create mode 100644 packages/stream_chat_localizations/example/README.md create mode 100644 packages/stream_chat_localizations/example/android/.gitignore create mode 100644 packages/stream_chat_localizations/example/android/app/build.gradle create mode 100644 packages/stream_chat_localizations/example/android/app/src/debug/AndroidManifest.xml create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/AndroidManifest.xml create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/drawable/launch_background.xml create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 packages/stream_chat_localizations/example/android/app/src/main/res/values/styles.xml create mode 100644 packages/stream_chat_localizations/example/android/app/src/profile/AndroidManifest.xml create mode 100644 packages/stream_chat_localizations/example/android/build.gradle create mode 100644 packages/stream_chat_localizations/example/android/gradle.properties create mode 100644 packages/stream_chat_localizations/example/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 packages/stream_chat_localizations/example/android/settings.gradle create mode 100644 packages/stream_chat_localizations/example/ios/.gitignore create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.pbxproj create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcworkspace/contents.xcworkspacedata create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 packages/stream_chat_localizations/example/ios/Runner/AppDelegate.swift create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Base.lproj/LaunchScreen.storyboard create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Base.lproj/Main.storyboard create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Info.plist create mode 100644 packages/stream_chat_localizations/example/ios/Runner/Runner-Bridging-Header.h create mode 100644 packages/stream_chat_localizations/example/lib/add_new_lang.dart create mode 100644 packages/stream_chat_localizations/example/lib/main.dart create mode 100644 packages/stream_chat_localizations/example/lib/override_lang.dart create mode 100644 packages/stream_chat_localizations/example/pubspec.yaml diff --git a/packages/stream_chat_localizations/example/.gitignore b/packages/stream_chat_localizations/example/.gitignore new file mode 100644 index 00000000..9d532b18 --- /dev/null +++ b/packages/stream_chat_localizations/example/.gitignore @@ -0,0 +1,41 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/packages/stream_chat_localizations/example/.metadata b/packages/stream_chat_localizations/example/.metadata new file mode 100644 index 00000000..182cccaf --- /dev/null +++ b/packages/stream_chat_localizations/example/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 78910062997c3a836feee883712c241a5fd22983 + channel: stable + +project_type: app diff --git a/packages/stream_chat_localizations/example/README.md b/packages/stream_chat_localizations/example/README.md new file mode 100644 index 00000000..07e5ac18 --- /dev/null +++ b/packages/stream_chat_localizations/example/README.md @@ -0,0 +1,2 @@ +# Stream Chat Persistence Example +Please see `lib/` for example code. \ No newline at end of file diff --git a/packages/stream_chat_localizations/example/android/.gitignore b/packages/stream_chat_localizations/example/android/.gitignore new file mode 100644 index 00000000..0a741cb4 --- /dev/null +++ b/packages/stream_chat_localizations/example/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/packages/stream_chat_localizations/example/android/app/build.gradle b/packages/stream_chat_localizations/example/android/app/build.gradle new file mode 100644 index 00000000..fbd6268e --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/build.gradle @@ -0,0 +1,64 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 30 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + lintOptions { + disable 'InvalidPackage' + checkReleaseBuilds false + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" + minSdkVersion 21 + targetSdkVersion 30 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/packages/stream_chat_localizations/example/android/app/src/debug/AndroidManifest.xml b/packages/stream_chat_localizations/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..c208884f --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/stream_chat_localizations/example/android/app/src/main/AndroidManifest.xml b/packages/stream_chat_localizations/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..55ca830c --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/stream_chat_localizations/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/packages/stream_chat_localizations/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 00000000..e793a000 --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/packages/stream_chat_localizations/example/android/app/src/main/res/drawable/launch_background.xml b/packages/stream_chat_localizations/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..db77bb4b7b0906d62b1847e87f15cdcacf6a4f29 GIT binary patch literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAj~WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8bpbvhu0Wd6uZuB!w&u2PAxD2eNXD>P5D~Wn-+_Wa#27Xc zC?Zj|6r#X(-D3u$NCt}(Ms06KgJ4FxJVv{GM)!I~&n8Bnc94O7-Hd)cjDZswgC;Qs zO=b+9!WcT8F?0rF7!Uys2bs@gozCP?z~o%U|N3vA*22NaGQG zlg@K`O_XuxvZ&Ks^m&R!`&1=spLvfx7oGDKDwpwW`#iqdw@AL`7MR}m`rwr|mZgU`8P7SBkL78fFf!WnuYWm$5Z0 zNXhDbCv&49sM544K|?c)WrFfiZvCi9h0O)B3Pgg&ebxsLQ05GG~ AQ2+n{ literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..17987b79bb8a35cc66c3c1fd44f5a5526c1b78be GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xx&nMcT!A!W`0S9QKQy;}1Cl^CgaH=;G9cpY;r$Q>i*pfB zP2drbID<_#qf;rPZx^FqH)F_D#*k@@q03KywUtLX8Ua?`H+NMzkczFPK3lFz@i_kW%1NOn0|D2I9n9wzH8m|-tHjsw|9>@K=iMBhxvkv6m8Y-l zytQ?X=U+MF$@3 zt`~i=@j|6y)RWMK--}M|=T`o&^Ni>IoWKHEbBXz7?A@mgWoL>!*SXo`SZH-*HSdS+ yn*9;$7;m`l>wYBC5bq;=U}IMqLzqbYCidGC!)_gkIk_C@Uy!y&wkt5C($~2D>~)O*cj@FGjOCM)M>_ixfudOh)?xMu#Fs z#}Y=@YDTwOM)x{K_j*Q;dPdJ?Mz0n|pLRx{4n|)f>SXlmV)XB04CrSJn#dS5nK2lM zrZ9#~WelCp7&e13Y$jvaEXHskn$2V!!DN-nWS__6T*l;H&Fopn?A6HZ-6WRLFP=R` zqG+CE#d4|IbyAI+rJJ`&x9*T`+a=p|0O(+s{UBcyZdkhj=yS1>AirP+0R;mf2uMgM zC}@~JfByORAh4SyRgi&!(cja>F(l*O+nd+@4m$|6K6KDn_&uvCpV23&>G9HJp{xgg zoq1^2_p9@|WEo z*X_Uko@K)qYYv~>43eQGMdbiGbo>E~Q& zrYBH{QP^@Sti!`2)uG{irBBq@y*$B zi#&(U-*=fp74j)RyIw49+0MRPMRU)+a2r*PJ$L5roHt2$UjExCTZSbq%V!HeS7J$N zdG@vOZB4v_lF7Plrx+hxo7(fCV&}fHq)$ literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..d5f1c8d34e7a88e3f88bea192c3a370d44689c3c GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=BuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFa`(sgt!6~Yi|1%a`XoT0ojZ}lNrNjb9xjc(B0U1_% zz5^97Xt*%oq$rQy4?0GKNfJ44uvxI)gC`h-NZ|&0-7(qS@?b!5r36oQ}zyZrNO3 zMO=Or+<~>+A&uN&E!^Sl+>xE!QC-|oJv`ApDhqC^EWD|@=#J`=d#Xzxs4ah}w&Jnc z$|q_opQ^2TrnVZ0o~wh<3t%W&flvYGe#$xqda2bR_R zvPYgMcHgjZ5nSA^lJr%;<&0do;O^tDDh~=pIxA#coaCY>&N%M2^tq^U%3DB@ynvKo}b?yu-bFc-u0JHzced$sg7S3zqI(2 z#Km{dPr7I=pQ5>FuK#)QwK?Y`E`B?nP+}U)I#c1+FM*1kNvWG|a(TpksZQ3B@sD~b zpQ2)*V*TdwjFOtHvV|;OsiDqHi=6%)o4b!)x$)%9pGTsE z-JL={-Ffv+T87W(Xpooq<`r*VzWQcgBN$$`u}f>-ZQI1BB8ykN*=e4rIsJx9>z}*o zo~|9I;xof literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/stream_chat_localizations/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6372eebdb28e45604e46eeda8dd24651419bc0 GIT binary patch literal 1443 zcmb`G{WsKk6vsdJTdFg%tJav9_E4vzrOaqkWF|A724Nly!y+?N9`YV6wZ}5(X(D_N(?!*n3`|_r0Hc?=PQw&*vnU?QTFY zB_MsH|!j$PP;I}?dppoE_gA(4uc!jV&0!l7_;&p2^pxNo>PEcNJv za5_RT$o2Mf!<+r?&EbHH6nMoTsDOa;mN(wv8RNsHpG)`^ymG-S5By8=l9iVXzN_eG%Xg2@Xeq76tTZ*dGh~Lo9vl;Zfs+W#BydUw zCkZ$o1LqWQO$FC9aKlLl*7x9^0q%0}$OMlp@Kk_jHXOjofdePND+j!A{q!8~Jn+s3 z?~~w@4?egS02}8NuulUA=L~QQfm;MzCGd)XhiftT;+zFO&JVyp2mBww?;QByS_1w! zrQlx%{^cMj0|Bo1FjwY@Q8?Hx0cIPF*@-ZRFpPc#bBw{5@tD(5%sClzIfl8WU~V#u zm5Q;_F!wa$BSpqhN>W@2De?TKWR*!ujY;Yylk_X5#~V!L*Gw~;$%4Q8~Mad z@`-kG?yb$a9cHIApZDVZ^U6Xkp<*4rU82O7%}0jjHlK{id@?-wpN*fCHXyXh(bLt* zPc}H-x0e4E&nQ>y%B-(EL=9}RyC%MyX=upHuFhAk&MLbsF0LP-q`XnH78@fT+pKPW zu72MW`|?8ht^tz$iC}ZwLp4tB;Q49K!QCF3@!iB1qOI=?w z7In!}F~ij(18UYUjnbmC!qKhPo%24?8U1x{7o(+?^Zu0Hx81|FuS?bJ0jgBhEMzf< zCgUq7r2OCB(`XkKcN-TL>u5y#dD6D!)5W?`O5)V^>jb)P)GBdy%t$uUMpf$SNV31$ zb||OojAbvMP?T@$h_ZiFLFVHDmbyMhJF|-_)HX3%m=CDI+ID$0^C>kzxprBW)hw(v zr!Gmda);ICoQyhV_oP5+C%?jcG8v+D@9f?Dk*!BxY}dazmrT@64UrP3hlslANK)bq z$67n83eh}OeW&SV@HG95P|bjfqJ7gw$e+`Hxo!4cx`jdK1bJ>YDSpGKLPZ^1cv$ek zIB?0S<#tX?SJCLWdMd{-ME?$hc7A$zBOdIJ)4!KcAwb=VMov)nK;9z>x~rfT1>dS+ zZ6#`2v@`jgbqq)P22H)Tx2CpmM^o1$B+xT6`(v%5xJ(?j#>Q$+rx_R|7TzDZe{J6q zG1*EcU%tE?!kO%^M;3aM6JN*LAKUVb^xz8-Pxo#jR5(-KBeLJvA@-gxNHx0M-ZJLl z;#JwQoh~9V?`UVo#}{6ka@II>++D@%KqGpMdlQ}?9E*wFcf5(#XQnP$Dk5~%iX^>f z%$y;?M0BLp{O3a(-4A?ewryHrrD%cx#Q^%KY1H zNre$ve+vceSLZcNY4U(RBX&)oZn*Py()h)XkE?PL$!bNb{N5FVI2Y%LKEm%yvpyTP z(1P?z~7YxD~Rf<(a@_y` literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/android/app/src/main/res/values/styles.xml b/packages/stream_chat_localizations/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..1f83a33f --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/stream_chat_localizations/example/android/app/src/profile/AndroidManifest.xml b/packages/stream_chat_localizations/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..c208884f --- /dev/null +++ b/packages/stream_chat_localizations/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/stream_chat_localizations/example/android/build.gradle b/packages/stream_chat_localizations/example/android/build.gradle new file mode 100644 index 00000000..3e0873de --- /dev/null +++ b/packages/stream_chat_localizations/example/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.5.20' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.2.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/packages/stream_chat_localizations/example/android/gradle.properties b/packages/stream_chat_localizations/example/android/gradle.properties new file mode 100644 index 00000000..a6738207 --- /dev/null +++ b/packages/stream_chat_localizations/example/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true +android.enableR8=true diff --git a/packages/stream_chat_localizations/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/stream_chat_localizations/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..3df6b338 --- /dev/null +++ b/packages/stream_chat_localizations/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip diff --git a/packages/stream_chat_localizations/example/android/settings.gradle b/packages/stream_chat_localizations/example/android/settings.gradle new file mode 100644 index 00000000..44e62bcf --- /dev/null +++ b/packages/stream_chat_localizations/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/packages/stream_chat_localizations/example/ios/.gitignore b/packages/stream_chat_localizations/example/ios/.gitignore new file mode 100644 index 00000000..e96ef602 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..261aa5a8 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,563 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0E9B23A7BA08E142FA5000CF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D76F8024ABE1070895D659BA /* Pods_Runner.framework */; }; + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3F6A054EEDAF06BCF649C130 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 6FE1ECA061EBB001F6BCE8B7 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D76F8024ABE1070895D659BA /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EC2A45E9198C1011BED23834 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0E9B23A7BA08E142FA5000CF /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 04AAB960E493BD92262BBF82 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D76F8024ABE1070895D659BA /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 8559384DCD98ED6067CEF8CB /* Pods */ = { + isa = PBXGroup; + children = ( + 3F6A054EEDAF06BCF649C130 /* Pods-Runner.debug.xcconfig */, + EC2A45E9198C1011BED23834 /* Pods-Runner.release.xcconfig */, + 6FE1ECA061EBB001F6BCE8B7 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 8559384DCD98ED6067CEF8CB /* Pods */, + 04AAB960E493BD92262BBF82 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + C1EE41B94EADE099F7AF3A1C /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + BD38DACC9A0AD429D9ED9939 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + BD38DACC9A0AD429D9ED9939 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + C1EE41B94EADE099F7AF3A1C /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..a28140cf --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..21a3cc14 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner/AppDelegate.swift b/packages/stream_chat_localizations/example/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..70693e4a --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..dc9ada4725e9b0ddb1deab583e5b5102493aa332 GIT binary patch literal 10932 zcmeHN2~<R zh`|8`A_PQ1nSu(UMFx?8j8PC!!VDphaL#`F42fd#7Vlc`zIE4n%Y~eiz4y1j|NDpi z?<@|pSJ-HM`qifhf@m%MamgwK83`XpBA<+azdF#2QsT{X@z0A9Bq>~TVErigKH1~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RX*hAqeq0TDkJ;5HB1%$3Np)99#16c{ zJImlNL(npL!W|Gr_kxl1GVmF5&^$^YherS7+~q$p zt}{a=*RiD2Ikv6o=IM1kgc7zqpaZ;OB)P!1zz*i3{U()Dq#jG)egvK}@uFLa`oyWZ zf~=MV)|yJn`M^$N%ul5);JuQvaU1r2wt(}J_Qgyy`qWQI`hEeRX0uC@c1(dQ2}=U$ tNIIaX+dr)NRWXcxoR{>fqI{SF_dm1Ylv~=3YHI)h002ovPDHLkV1g(pWS;;4 literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..f091b6b0bca859a3f474b03065bef75ba58a9e4c GIT binary patch literal 1588 zcmV-42Fv-0P)C1SqPt}wig>|5Crh^=oyX$BK<}M8eLU3e2hGT;=G|!_SP)7zNI6fqUMB=)y zRAZ>eDe#*r`yDAVgB_R*LB*MAc)8(b{g{9McCXW!lq7r(btRoB9!8B-#AI6JMb~YFBEvdsV)`mEQO^&#eRKx@b&x- z5lZm*!WfD8oCLzfHGz#u7sT0^VLMI1MqGxF^v+`4YYnVYgk*=kU?HsSz{v({E3lb9 z>+xILjBN)t6`=g~IBOelGQ(O990@BfXf(DRI5I$qN$0Gkz-FSc$3a+2fX$AedL4u{ z4V+5Ong(9LiGcIKW?_352sR;LtDPmPJXI{YtT=O8=76o9;*n%_m|xo!i>7$IrZ-{l z-x3`7M}qzHsPV@$v#>H-TpjDh2UE$9g6sysUREDy_R(a)>=eHw-WAyfIN z*qb!_hW>G)Tu8nSw9yn#3wFMiLcfc4pY0ek1}8(NqkBR@t4{~oC>ryc-h_ByH(Cg5 z>ao-}771+xE3um9lWAY1FeQFxowa1(!J(;Jg*wrg!=6FdRX+t_<%z&d&?|Bn){>zm zZQj(aA_HeBY&OC^j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69elMypu?t>op*wBx<=Wx8?( ztpe^(fwM6jJX7M-l*k3kEpWOl_Vk3@(_w4oc}4YF4|Rt=2V^XU?#Yz`8(e?aZ@#li0n*=g^qOcVpd-Wbok=@b#Yw zqn8u9a)z>l(1kEaPYZ6hwubN6i<8QHgsu0oE) ziJ(p;Wxm>sf!K+cw>R-(^Y2_bahB+&KI9y^);#0qt}t-$C|Bo71lHi{_+lg#f%RFy z0um=e3$K3i6K{U_4K!EX?F&rExl^W|G8Z8;`5z-k}OGNZ0#WVb$WCpQu-_YsiqKP?BB# vzVHS-CTUF4Ozn5G+mq_~Qqto~ahA+K`|lyv3(-e}00000NkvXXu0mjfd`9t{ literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d0ef06e7edb86cdfe0d15b4b0d98334a86163658 GIT binary patch literal 1716 zcmds$`#;kQ7{|XelZftyR5~xW7?MLxS4^|Hw3&P7^y)@A9Fj{Xm1~_CIV^XZ%SLBn zA;!r`GqGHg=7>xrB{?psZQs88ZaedDoagm^KF{a*>G|dJWRSe^I$DNW008I^+;Kjt z>9p3GNR^I;v>5_`+91i(*G;u5|L+Bu6M=(afLjtkya#yZ175|z$pU~>2#^Z_pCZ7o z1c6UNcv2B3?; zX%qdxCXQpdKRz=#b*q0P%b&o)5ZrNZt7$fiETSK_VaY=mb4GK`#~0K#~9^ zcY!`#Af+4h?UMR-gMKOmpuYeN5P*RKF!(tb`)oe0j2BH1l?=>y#S5pMqkx6i{*=V9JF%>N8`ewGhRE(|WohnD59R^$_36{4>S zDFlPC5|k?;SPsDo87!B{6*7eqmMdU|QZ84>6)Kd9wNfh90=y=TFQay-0__>=<4pk& zYDjgIhL-jQ9o>z32K)BgAH+HxamL{ZL~ozu)Qqe@a`FpH=o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|Gr_kxl1GVmF5&^$^YherS7+~q$p zt}{a=*RiD2Ikv6o=IM1kgc7zqpaZ;OB)P!1zz*i3{U()Dq#jG)egvK}@uFLa`oyWZ zf~=MV)|yJn`M^$N%ul5);JuQvaU1r2wt(}J_Qgyy`qWQI`hEeRX0uC@c1(dQ2}=U$ tNIIaX+dr)NRWXcxoR{>fqI{SF_dm1Ylv~=3YHI)h002ovPDHLkV1g(pWS;;4 literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..c8f9ed8f5cee1c98386d13b17e89f719e83555b2 GIT binary patch literal 1895 zcmV-t2blPYP)FQtfgmafE#=YDCq`qUBt#QpG%*H6QHY765~R=q zZ6iudfM}q!Pz#~9JgOi8QJ|DSu?1-*(kSi1K4#~5?#|rh?sS)(-JQqX*}ciXJ56_H zdw=^s_srbAdqxlvGyrgGet#6T7_|j;95sL%MtM;q86vOxKM$f#puR)Bjv9Zvz9-di zXOTSsZkM83)E9PYBXC<$6(|>lNLVBb&&6y{NByFCp%6+^ALR@NCTse_wqvNmSWI-m z!$%KlHFH2omF!>#%1l3LTZg(s7eof$7*xB)ZQ0h?ejh?Ta9fDv59+u#MokW+1t8Zb zgHv%K(u9G^Lv`lh#f3<6!JVTL3(dCpxHbnbA;kKqQyd1~^Xe0VIaYBSWm6nsr;dFj z4;G-RyL?cYgsN1{L4ZFFNa;8)Rv0fM0C(~Tkit94 zz#~A)59?QjD&pAPSEQ)p8gP|DS{ng)j=2ux)_EzzJ773GmQ_Cic%3JJhC0t2cx>|v zJcVusIB!%F90{+}8hG3QU4KNeKmK%T>mN57NnCZ^56=0?&3@!j>a>B43pi{!u z7JyDj7`6d)qVp^R=%j>UIY6f+3`+qzIc!Y_=+uN^3BYV|o+$vGo-j-W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40x40@3x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b8609df07bf62e5100a53a01510388bd2b22 GIT binary patch literal 2665 zcmV-v3YPVWP)oFh3q0MFesq&64WThn3$;G69TfjsAv=f2G9}p zgSx99+!YV6qME!>9MD13x)k(+XE7W?_O4LoLb5ND8 zaV{9+P@>42xDfRiYBMSgD$0!vssptcb;&?u9u(LLBKmkZ>RMD=kvD3h`sk6!QYtBa ztlZI#nu$8lJ^q2Z79UTgZe>BU73(Aospiq+?SdMt8lDZ;*?@tyWVZVS_Q7S&*tJaiRlJ z+aSMOmbg3@h5}v;A*c8SbqM3icg-`Cnwl;7Ts%A1RkNIp+Txl-Ckkvg4oxrqGA5ewEgYqwtECD<_3Egu)xGllKt&J8g&+=ac@Jq4-?w6M3b*>w5 z69N3O%=I^6&UL5gZ!}trC7bUj*12xLdkNs~Bz4QdJJ*UDZox2UGR}SNg@lmOvhCc~ z*f_UeXv(=#I#*7>VZx2ObEN~UoGUTl=-@)E;YtCRZ>SVp$p9yG5hEFZ!`wI!spd)n zSk+vK0Vin7FL{7f&6OB%f;SH22dtbcF<|9fi2Fp%q4kxL!b1#l^)8dUwJ zwEf{(wJj@8iYDVnKB`eSU+;ml-t2`@%_)0jDM`+a46xhDbBj2+&Ih>1A>6aky#(-SYyE{R3f#y57wfLs z6w1p~$bp;6!9DX$M+J~S@D6vJAaElETnsX4h9a5tvPhC3L@qB~bOzkL@^z0k_hS{T4PF*TDrgdXp+dzsE? z>V|VR035Pl9n5&-RePFdS{7KAr2vPOqR9=M$vXA1Yy5>w;EsF`;OK{2pkn-kpp9Pw z)r;5JfJKKaT$4qCb{TaXHjb$QA{y0EYy*+b1XI;6Ah- zw13P)xT`>~eFoJC!>{2XL(a_#upp3gaR1#5+L(Jmzp4TBnx{~WHedpJ1ch8JFk~Sw z>F+gN+i+VD?gMXwcIhn8rz`>e>J^TI3E-MW>f}6R-pL}>WMOa0k#jN+`RyUVUC;#D zg|~oS^$6%wpF{^Qr+}X>0PKcr3Fc&>Z>uv@C);pwDs@2bZWhYP!rvGx?_|q{d`t<*XEb#=aOb=N+L@CVBGqImZf&+a zCQEa3$~@#kC);pasdG=f6tuIi0PO-y&tvX%>Mv=oY3U$nD zJ#gMegnQ46pq+3r=;zmgcG+zRc9D~c>z+jo9&D+`E6$LmyFqlmCYw;-Zooma{sR@~ z)_^|YL1&&@|GXo*pivH7k!msl+$Sew3%XJnxajt0K%3M6Bd&YFNy9}tWG^aovK2eX z1aL1%7;KRDrA@eG-Wr6w+;*H_VD~qLiVI`{_;>o)k`{8xa3EJT1O_>#iy_?va0eR? zDV=N%;Zjb%Z2s$@O>w@iqt!I}tLjGk!=p`D23I}N4Be@$(|iSA zf3Ih7b<{zqpDB4WF_5X1(peKe+rASze%u8eKLn#KKXt;UZ+Adf$_TO+vTqshLLJ5c z52HucO=lrNVae5XWOLm!V@n-ObU11!b+DN<$RuU+YsrBq*lYT;?AwJpmNKniF0Q1< zJCo>Q$=v$@&y=sj6{r!Y&y&`0$-I}S!H_~pI&2H8Z1C|BX4VgZ^-! zje3-;x0PBD!M`v*J_)rL^+$<1VJhH*2Fi~aA7s&@_rUHYJ9zD=M%4AFQ`}k8OC$9s XsPq=LnkwKG00000NkvXXu0mjfhAk5^ literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b8609df07bf62e5100a53a01510388bd2b22 GIT binary patch literal 2665 zcmV-v3YPVWP)oFh3q0MFesq&64WThn3$;G69TfjsAv=f2G9}p zgSx99+!YV6qME!>9MD13x)k(+XE7W?_O4LoLb5ND8 zaV{9+P@>42xDfRiYBMSgD$0!vssptcb;&?u9u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|GXo*pivH7k!msl+$Sew3%XJnxajt0K%3M6Bd&YFNy9}tWG^aovK2eX z1aL1%7;KRDrA@eG-Wr6w+;*H_VD~qLiVI`{_;>o)k`{8xa3EJT1O_>#iy_?va0eR? zDV=N%;Zjb%Z2s$@O>w@iqt!I}tLjGk!=p`D23I}N4Be@$(|iSA zf3Ih7b<{zqpDB4WF_5X1(peKe+rASze%u8eKLn#KKXt;UZ+Adf$_TO+vTqshLLJ5c z52HucO=lrNVae5XWOLm!V@n-ObU11!b+DN<$RuU+YsrBq*lYT;?AwJpmNKniF0Q1< zJCo>Q$=v$@&y=sj6{r!Y&y&`0$-I}S!H_~pI&2H8Z1C|BX4VgZ^-! zje3-;x0PBD!M`v*J_)rL^+$<1VJhH*2Fi~aA7s&@_rUHYJ9zD=M%4AFQ`}k8OC$9s XsPq=LnkwKG00000NkvXXu0mjfhAk5^ literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..75b2d164a5a98e212cca15ea7bf2ab5de5108680 GIT binary patch literal 3831 zcmVjJBgitF5mAp-i>4+KS_oR{|13AP->1TD4=w)g|)JHOx|a2Wk1Va z!k)vP$UcQ#mdj%wNQoaJ!w>jv_6&JPyutpQps?s5dmDQ>`%?Bvj>o<%kYG!YW6H-z zu`g$@mp`;qDR!51QaS}|ZToSuAGcJ7$2HF0z`ln4t!#Yg46>;vGG9N9{V@9z#}6v* zfP?}r6b{*-C*)(S>NECI_E~{QYzN5SXRmVnP<=gzP+_Sp(Aza_hKlZ{C1D&l*(7IKXxQC1Z9#6wx}YrGcn~g%;icdw>T0Rf^w0{ z$_wn1J+C0@!jCV<%Go5LA45e{5gY9PvZp8uM$=1}XDI+9m7!A95L>q>>oe0$nC->i zeexUIvq%Uk<-$>DiDb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aGOK z225E@kH5Opf+CgD^{y29jD4gHbGf{1MD6ggQ&%>UG4WyPh5q_tb`{@_34B?xfSO*| zZv8!)q;^o-bz`MuxXk*G^}(6)ACb@=Lfs`Hxoh>`Y0NE8QRQ!*p|SH@{r8=%RKd4p z+#Ty^-0kb=-H-O`nAA3_6>2z(D=~Tbs(n8LHxD0`R0_ATFqp-SdY3(bZ3;VUM?J=O zKCNsxsgt@|&nKMC=*+ZqmLHhX1KHbAJs{nGVMs6~TiF%Q)P@>!koa$%oS zjXa=!5>P`vC-a}ln!uH1ooeI&v?=?v7?1n~P(wZ~0>xWxd_Aw;+}9#eULM7M8&E?Y zC-ZLhi3RoM92SXUb-5i-Lmt5_rfjE{6y^+24`y$1lywLyHO!)Boa7438K4#iLe?rh z2O~YGSgFUBH?og*6=r9rme=peP~ah`(8Zt7V)j5!V0KPFf_mebo3z95U8(up$-+EA^9dTRLq>Yl)YMBuch9%=e5B`Vnb>o zt03=kq;k2TgGe4|lGne&zJa~h(UGutjP_zr?a7~#b)@15XNA>Dj(m=gg2Q5V4-$)D|Q9}R#002ovPDHLkV1o7DH3k3x literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..c4df70d39da7941ef3f6dcb7f06a192d8dcb308d GIT binary patch literal 1888 zcmV-m2cP(fP)x~L`~4d)Rspd&<9kFh{hn*KP1LP0~$;u(LfAu zp%fx&qLBcRHx$G|3q(bv@+b;o0*D|jwD-Q9uQR(l*ST}s+uPgQ-MeFwZ#GS?b332? z&Tk$&_miXn3IGq)AmQ)3sisq{raD4(k*bHvpCe-TdWq^NRTEVM)i9xbgQ&ccnUVx* zEY%vS%gDcSg=!tuIK8$Th2_((_h^+7;R|G{n06&O2#6%LK`a}n?h_fL18btz<@lFG za}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LAd;in9{)95YqX$J43-dY7YU*k~vrM25 zxh5_IqO0LYZW%oxQ5HOzmk4x{atE*vipUk}sh88$b2tn?!ujEHn`tQLe&vo}nMb&{ zio`xzZ&GG6&ZyN3jnaQy#iVqXE9VT(3tWY$n-)uWDQ|tc{`?fq2F`oQ{;d3aWPg4Hp-(iE{ry>MIPWL> iW8Zci7-kcv6Uzs@r-FtIZ-&5|)J Q1PU{Fy85}Sb4q9e0B4a5jsO4v literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..9da19eacad3b03bb08bbddbbf4ac48dd78b3d838 GIT binary patch literal 68 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx0wlM}@Gt=>Zci7-kcv6Uzs@r-FtIZ-&5|)J Q1PU{Fy85}Sb4q9e0B4a5jsO4v literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..9da19eacad3b03bb08bbddbbf4ac48dd78b3d838 GIT binary patch literal 68 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx0wlM}@Gt=>Zci7-kcv6Uzs@r-FtIZ-&5|)J Q1PU{Fy85}Sb4q9e0B4a5jsO4v literal 0 HcmV?d00001 diff --git a/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/stream_chat_localizations/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/stream_chat_localizations/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner/Base.lproj/Main.storyboard b/packages/stream_chat_localizations/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner/Info.plist b/packages/stream_chat_localizations/example/ios/Runner/Info.plist new file mode 100644 index 00000000..a060db61 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/packages/stream_chat_localizations/example/ios/Runner/Runner-Bridging-Header.h b/packages/stream_chat_localizations/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/packages/stream_chat_localizations/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/packages/stream_chat_localizations/example/lib/add_new_lang.dart b/packages/stream_chat_localizations/example/lib/add_new_lang.dart new file mode 100644 index 00000000..1412f4e0 --- /dev/null +++ b/packages/stream_chat_localizations/example/lib/add_new_lang.dart @@ -0,0 +1,500 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; + +class _NnStreamChatLocalizationsDelegate + extends LocalizationsDelegate { + const _NnStreamChatLocalizationsDelegate(); + + @override + bool isSupported(Locale locale) => locale.languageCode == 'nn'; + + @override + Future load(Locale locale) => + SynchronousFuture(const NnStreamChatLocalizations()); + + @override + bool shouldReload(_NnStreamChatLocalizationsDelegate old) => false; +} + +/// A custom set of localizations for the 'nn' locale. In this example, only +/// the value for launchUrlError was modified to use a custom message as +/// an example. Everything else uses the American English (en_US) messages +/// and formatting. +class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { + /// Create an instance of the translation bundle for English. + const NnStreamChatLocalizations({String localeName = 'nn'}) + : super(localeName: localeName); + + /// A [LocalizationsDelegate] for [NnStreamChatLocalizations]. + static const delegate = _NnStreamChatLocalizationsDelegate(); + + @override + String get launchUrlError => 'Custom error'; + + @override + String get loadingUsersError => 'Error loading users'; + + @override + String get noUsersLabel => 'There are no users currently'; + + @override + String get retryLabel => 'Retry'; + + @override + String get userLastOnlineText => 'Last online'; + + @override + String get userOnlineText => 'Online'; + + @override + String userTypingText(Iterable users) { + if (users.isEmpty) return ''; + final first = users.first; + if (users.length == 1) { + return '${first.name} is typing'; + } + return '${first.name} and ${users.length - 1} more are typing'; + } + + @override + String get threadReplyLabel => 'Thread Reply'; + + @override + String get onlyVisibleToYouText => 'Only visible to you'; + + @override + String threadReplyCountText(int count) => '$count Thread Replies'; + + @override + String attachmentsUploadProgressText({ + required int remaining, + required int total, + }) => + 'Uploading $remaining/$total ...'; + + @override + String pinnedByUserText({ + required User pinnedBy, + required User currentUser, + }) { + final pinnedByCurrentUser = currentUser.id == pinnedBy.id; + if (pinnedByCurrentUser) return 'Pinned by You'; + return 'Pinned by ${pinnedBy.name}'; + } + + @override + String get emptyMessagesText => 'There are no messages currently'; + + @override + String get genericErrorText => 'Something went wrong'; + + @override + String get loadingMessagesError => 'Error loading messages'; + + @override + String resultCountText(int count) => '$count results'; + + @override + String get messageDeletedText => 'This message is deleted.'; + + @override + String get messageDeletedLabel => 'Message deleted'; + + @override + String get messageReactionsLabel => 'Message Reactions'; + + @override + String get emptyChatMessagesText => 'No chats here yet...'; + + @override + String threadSeparatorText(int replyCount) { + if (replyCount == 1) return '1 Reply'; + return '$replyCount Replies'; + } + + @override + String get connectedLabel => 'Connected'; + + @override + String get disconnectedLabel => 'Disconnected'; + + @override + String get reconnectingLabel => 'Reconnecting...'; + + @override + String get alsoSendAsDirectMessageLabel => 'Also send as direct message'; + + @override + String get addACommentOrSendLabel => 'Add a comment or send'; + + @override + String get searchGifLabel => 'Search GIFs'; + + @override + String get writeAMessageLabel => 'Write a message'; + + @override + String get instantCommandsLabel => 'Instant Commands'; + + @override + String fileTooLargeAfterCompressionError(double limitInMB) => + 'The file is too large to upload. ' + 'The file size limit is $limitInMB MB. ' + 'We tried compressing it, but it was not enough.'; + + @override + String fileTooLargeError(double limitInMB) => + 'The file is too large to upload. The file size limit is $limitInMB MB.'; + + @override + String emojiMatchingQueryText(String query) => 'Emoji matching "$query"'; + + @override + String get addAFileLabel => 'Add a file'; + + @override + String get photoFromCameraLabel => 'Photo from camera'; + + @override + String get uploadAFileLabel => 'Upload a file'; + + @override + String get uploadAPhotoLabel => 'Upload a photo'; + + @override + String get uploadAVideoLabel => 'Upload a video'; + + @override + String get videoFromCameraLabel => 'Video from camera'; + + @override + String get okLabel => 'OK'; + + @override + String get somethingWentWrongError => 'Something went wrong'; + + @override + String get addMoreFilesLabel => 'Add more files'; + + @override + String get enablePhotoAndVideoAccessMessage => + 'Please enable access to your photos' + '\nand videos so you can share them with friends.'; + + @override + String get allowGalleryAccessMessage => 'Allow access to your gallery'; + + @override + String get flagMessageLabel => 'Flag Message'; + + @override + String get flagMessageQuestion => + 'Do you want to send a copy of this message to a' + '\nmoderator for further investigation?'; + + @override + String get flagLabel => 'FLAG'; + + @override + String get cancelLabel => 'CANCEL'; + + @override + String get flagMessageSuccessfulLabel => 'Message flagged'; + + @override + String get flagMessageSuccessfulText => + 'The message has been reported to a moderator.'; + + @override + String get deleteLabel => 'DELETE'; + + @override + String get deleteMessageLabel => 'Delete Message'; + + @override + String get deleteMessageQuestion => + 'Are you sure you want to permanently delete this\nmessage?'; + + @override + String get operationCouldNotBeCompletedText => + 'The operation couldn\'t be completed.'; + + @override + String get replyLabel => 'Reply'; + + @override + String togglePinUnpinText({required bool pinned}) { + if (pinned) return 'Unpin from Conversation'; + return 'Pin to Conversation'; + } + + @override + String toggleDeleteRetryDeleteMessageText({required bool isDeleteFailed}) { + if (isDeleteFailed) return 'Retry Deleting Message'; + return 'Delete Message'; + } + + @override + String get copyMessageLabel => 'Copy Message'; + + @override + String get editMessageLabel => 'Edit Message'; + + @override + String toggleResendOrResendEditedMessage({required bool isUpdateFailed}) { + if (isUpdateFailed) return 'Resend Edited Message'; + return 'Resend'; + } + + @override + String get photosLabel => 'Photos'; + + String _getDay(DateTime dateTime) { + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final yesterday = DateTime(now.year, now.month, now.day - 1); + + final date = DateTime(dateTime.year, dateTime.month, dateTime.day); + + if (date == today) { + return 'today'; + } else if (date == yesterday) { + return 'yesterday'; + } else { + return 'on ${Jiffy(date).MMMd}'; + } + } + + @override + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; + + @override + String get todayLabel => 'Today'; + + @override + String get yesterdayLabel => 'Yesterday'; + + @override + String get channelIsMutedText => 'Channel is muted'; + + @override + String get noTitleText => 'No title'; + + @override + String get letsStartChattingLabel => 'Let’s start chatting!'; + + @override + String get sendingFirstMessageLabel => + 'How about sending your first message to a friend?'; + + @override + String get startAChatLabel => 'Start a chat'; + + @override + String get loadingChannelsError => 'Error loading channels'; + + @override + String get deleteConversationLabel => 'Delete Conversation'; + + @override + String get deleteConversationQuestion => + 'Are you sure you want to delete this conversation?'; + + @override + String get streamChatLabel => 'Stream Chat'; + + @override + String get searchingForNetworkText => 'Searching for Network'; + + @override + String get offlineLabel => 'Offline...'; + + @override + String get tryAgainLabel => 'Try Again'; + + @override + String membersCountText(int count) { + if (count == 1) return '1 Member'; + return '$count Members'; + } + + @override + String watchersCountText(int count) { + if (count == 1) return '1 Online'; + return '$count Online'; + } + + @override + String get viewInfoLabel => 'View Info'; + + @override + String get leaveGroupLabel => 'Leave Group'; + + @override + String get leaveLabel => 'LEAVE'; + + @override + String get leaveConversationLabel => 'Leave conversation'; + + @override + String get leaveConversationQuestion => + 'Are you sure you want to leave this conversation?'; + + @override + String get showInChatLabel => 'Show in Chat'; + + @override + String get saveImageLabel => 'Save Image'; + + @override + String get saveVideoLabel => 'Save Video'; + + @override + String get uploadErrorLabel => 'UPLOAD ERROR'; + + @override + String get giphyLabel => 'Giphy'; + + @override + String get shuffleLabel => 'Shuffle'; + + @override + String get sendLabel => 'Send'; + + @override + String get withText => 'with'; + + @override + String get inText => 'in'; + + @override + String get youText => 'You'; + + @override + String get ofText => 'of'; + + @override + String get fileText => 'File'; + + @override + String get replyToMessageLabel => 'Reply to Message'; +} + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + + /// Create a new instance of [StreamChatClient] passing the apikey obtained + /// from your project dashboard. + final client = StreamChatClient( + 's2dxdhpxd94g', + logLevel: Level.INFO, + ); + + /// Set the current user and connect the websocket. In a production + /// scenario, this should be done using a backend to generate a user token + /// using our server SDK. + /// + /// Please see the following for more information: + /// https://getstream.io/chat/docs/ios_user_setup_and_tokens/ + await client.connectUser( + User(id: 'super-band-9'), + 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.' + '0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', + ); + + final channel = client.channel('messaging', id: 'godevs'); + + await channel.watch(); + + runApp( + MyApp( + client: client, + channel: channel, + ), + ); +} + +/// Example application using Stream Chat Flutter widgets. +/// +/// Stream Chat Flutter is a set of Flutter widgets which provide full chat +/// functionalities for building Flutter applications using Stream. If you'd +/// prefer using minimal wrapper widgets for your app, please see our other +/// package, `stream_chat_flutter_core`. +class MyApp extends StatelessWidget { + /// Example using Stream's Flutter package. + /// + /// If you'd prefer using minimal wrapper widgets for your app, please see + /// our other package, `stream_chat_flutter_core`. + const MyApp({ + Key? key, + required this.client, + required this.channel, + }) : super(key: key); + + /// Instance of Stream Client. + /// + /// Stream's [StreamChatClient] can be used to connect to our servers and + /// set the default user for the application. Performing these actions + /// trigger a websocket connection allowing for real-time updates. + final StreamChatClient client; + + /// Instance of the Channel + final Channel channel; + + @override + Widget build(BuildContext context) => MaterialApp( + theme: ThemeData.light(), + darkTheme: ThemeData.dark(), + // Add all the supported locales + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('it'), + // Add support for additional 'nn' locale + Locale('nn'), + ], + // Add overridden "NnStreamChatLocalizations.delegate" along with + // "GlobalStreamChatLocalizations.delegates" + localizationsDelegates: const [ + NnStreamChatLocalizations.delegate, + ...GlobalStreamChatLocalizations.delegates, + ], + builder: (context, widget) => StreamChat( + client: client, + child: widget, + ), + home: StreamChannel( + channel: channel, + child: const ChannelPage(), + ), + ); +} + +/// A list of messages sent in the current channel. +/// +/// This is implemented using [MessageListView], a widget that provides query +/// functionalities fetching the messages from the api and showing them in a +/// listView. +class ChannelPage extends StatelessWidget { + /// Creates the page that shows the list of messages + const ChannelPage({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) => Scaffold( + appBar: const ChannelHeader(), + body: Column( + children: const [ + Expanded( + child: MessageListView(), + ), + MessageInput(), + ], + ), + ); +} diff --git a/packages/stream_chat_localizations/example/lib/main.dart b/packages/stream_chat_localizations/example/lib/main.dart new file mode 100644 index 00000000..95e1130d --- /dev/null +++ b/packages/stream_chat_localizations/example/lib/main.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + + /// Create a new instance of [StreamChatClient] passing the apikey obtained + /// from your project dashboard. + final client = StreamChatClient( + 's2dxdhpxd94g', + logLevel: Level.INFO, + ); + + /// Set the current user and connect the websocket. In a production + /// scenario, this should be done using a backend to generate a user token + /// using our server SDK. + /// + /// Please see the following for more information: + /// https://getstream.io/chat/docs/ios_user_setup_and_tokens/ + await client.connectUser( + User(id: 'super-band-9'), + 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.' + '0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', + ); + + final channel = client.channel('messaging', id: 'godevs'); + + await channel.watch(); + + runApp( + MyApp( + client: client, + channel: channel, + ), + ); +} + +/// Example application using Stream Chat Flutter widgets. +/// +/// Stream Chat Flutter is a set of Flutter widgets which provide full chat +/// functionalities for building Flutter applications using Stream. If you'd +/// prefer using minimal wrapper widgets for your app, please see our other +/// package, `stream_chat_flutter_core`. +class MyApp extends StatelessWidget { + /// Example using Stream's Flutter package. + /// + /// If you'd prefer using minimal wrapper widgets for your app, please see + /// our other package, `stream_chat_flutter_core`. + const MyApp({ + Key? key, + required this.client, + required this.channel, + }) : super(key: key); + + /// Instance of Stream Client. + /// + /// Stream's [StreamChatClient] can be used to connect to our servers and + /// set the default user for the application. Performing these actions + /// trigger a websocket connection allowing for real-time updates. + final StreamChatClient client; + + /// Instance of the Channel + final Channel channel; + + @override + Widget build(BuildContext context) { + return MaterialApp( + theme: ThemeData.light(), + darkTheme: ThemeData.dark(), + // Add all the supported locales + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('it'), + ], + // Add GlobalStreamChatLocalizations.delegates + localizationsDelegates: GlobalStreamChatLocalizations.delegates, + builder: (context, widget) => StreamChat( + client: client, + child: widget, + ), + home: StreamChannel( + channel: channel, + child: const ChannelPage(), + ), + ); + } +} + +/// A list of messages sent in the current channel. +/// +/// This is implemented using [MessageListView], a widget that provides query +/// functionalities fetching the messages from the api and showing them in a +/// listView. +class ChannelPage extends StatelessWidget { + /// Creates the page that shows the list of messages + const ChannelPage({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) => Scaffold( + appBar: const ChannelHeader(), + body: Column( + children: const [ + Expanded( + child: MessageListView(), + ), + MessageInput(), + ], + ), + ); +} diff --git a/packages/stream_chat_localizations/example/lib/override_lang.dart b/packages/stream_chat_localizations/example/lib/override_lang.dart new file mode 100644 index 00000000..0e45019a --- /dev/null +++ b/packages/stream_chat_localizations/example/lib/override_lang.dart @@ -0,0 +1,142 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; + +class _CustomStreamChatLocalizationsDelegate + extends LocalizationsDelegate { + const _CustomStreamChatLocalizationsDelegate(); + + @override + bool isSupported(Locale locale) => locale.languageCode == 'en'; + + @override + Future load(Locale locale) => + SynchronousFuture(CustomStreamChatLocalizationsEn()); + + @override + bool shouldReload(_CustomStreamChatLocalizationsDelegate old) => false; +} + +/// Customized translations for English ('en') +class CustomStreamChatLocalizationsEn extends StreamChatLocalizationsEn { + /// A [LocalizationsDelegate] for [StreamChatLocalizationsEn]. + static const delegate = _CustomStreamChatLocalizationsDelegate(); + + @override + String get launchUrlError => 'My custom error'; +} + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + + /// Create a new instance of [StreamChatClient] passing the apikey obtained + /// from your project dashboard. + final client = StreamChatClient( + 's2dxdhpxd94g', + logLevel: Level.INFO, + ); + + /// Set the current user and connect the websocket. In a production + /// scenario, this should be done using a backend to generate a user token + /// using our server SDK. + /// + /// Please see the following for more information: + /// https://getstream.io/chat/docs/ios_user_setup_and_tokens/ + await client.connectUser( + User(id: 'super-band-9'), + 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.' + '0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', + ); + + final channel = client.channel('messaging', id: 'godevs'); + + await channel.watch(); + + runApp( + MyApp( + client: client, + channel: channel, + ), + ); +} + +/// Example application using Stream Chat Flutter widgets. +/// +/// Stream Chat Flutter is a set of Flutter widgets which provide full chat +/// functionalities for building Flutter applications using Stream. If you'd +/// prefer using minimal wrapper widgets for your app, please see our other +/// package, `stream_chat_flutter_core`. +class MyApp extends StatelessWidget { + /// Example using Stream's Flutter package. + /// + /// If you'd prefer using minimal wrapper widgets for your app, please see + /// our other package, `stream_chat_flutter_core`. + const MyApp({ + Key? key, + required this.client, + required this.channel, + }) : super(key: key); + + /// Instance of Stream Client. + /// + /// Stream's [StreamChatClient] can be used to connect to our servers and + /// set the default user for the application. Performing these actions + /// trigger a websocket connection allowing for real-time updates. + final StreamChatClient client; + + /// Instance of the Channel + final Channel channel; + + @override + Widget build(BuildContext context) => MaterialApp( + theme: ThemeData.light(), + darkTheme: ThemeData.dark(), + // Add all the supported locales + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('it'), + ], + // Add overridden "CustomStreamChatLocalizationsEn.delegate" along with + // "GlobalStreamChatLocalizations.delegates" + localizationsDelegates: const [ + CustomStreamChatLocalizationsEn.delegate, + ...GlobalStreamChatLocalizations.delegates, + ], + builder: (context, widget) => StreamChat( + client: client, + child: widget, + ), + home: StreamChannel( + channel: channel, + child: const ChannelPage(), + ), + ); +} + +/// A list of messages sent in the current channel. +/// +/// This is implemented using [MessageListView], a widget that provides query +/// functionalities fetching the messages from the api and showing them in a +/// listView. +class ChannelPage extends StatelessWidget { + /// Creates the page that shows the list of messages + const ChannelPage({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) => Scaffold( + appBar: const ChannelHeader(), + body: Column( + children: const [ + Expanded( + child: MessageListView(), + ), + MessageInput(), + ], + ), + ); +} diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml new file mode 100644 index 00000000..a139831e --- /dev/null +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -0,0 +1,26 @@ +name: example +description: A new Flutter project. + +publish_to: 'none' +version: 1.0.0+1 + +environment: + sdk: ">=2.12.0 <3.0.0" + +dependencies: + cupertino_icons: ^1.0.3 + flutter: + sdk: flutter + stream_chat_localizations: + path: ../ + +dependency_overrides: + stream_chat_flutter: + path: ../../stream_chat_flutter + +dev_dependencies: + flutter_test: + sdk: flutter + +flutter: + uses-material-design: true \ No newline at end of file From d6db3d84e05dc5357fc4273d024c9904252ee6d6 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jul 2021 16:56:21 +0530 Subject: [PATCH 30/35] chore(localization): fix analyzer warning Signed-off-by: xsahil03x --- .../example/lib/main.dart | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/packages/stream_chat_localizations/example/lib/main.dart b/packages/stream_chat_localizations/example/lib/main.dart index 95e1130d..436553c1 100644 --- a/packages/stream_chat_localizations/example/lib/main.dart +++ b/packages/stream_chat_localizations/example/lib/main.dart @@ -64,29 +64,27 @@ class MyApp extends StatelessWidget { final Channel channel; @override - Widget build(BuildContext context) { - return MaterialApp( - theme: ThemeData.light(), - darkTheme: ThemeData.dark(), - // Add all the supported locales - supportedLocales: const [ - Locale('en'), - Locale('hi'), - Locale('fr'), - Locale('it'), - ], - // Add GlobalStreamChatLocalizations.delegates - localizationsDelegates: GlobalStreamChatLocalizations.delegates, - builder: (context, widget) => StreamChat( - client: client, - child: widget, - ), - home: StreamChannel( - channel: channel, - child: const ChannelPage(), - ), - ); - } + Widget build(BuildContext context) => MaterialApp( + theme: ThemeData.light(), + darkTheme: ThemeData.dark(), + // Add all the supported locales + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('it'), + ], + // Add GlobalStreamChatLocalizations.delegates + localizationsDelegates: GlobalStreamChatLocalizations.delegates, + builder: (context, widget) => StreamChat( + client: client, + child: widget, + ), + home: StreamChannel( + channel: channel, + child: const ChannelPage(), + ), + ); } /// A list of messages sent in the current channel. From e7a7521669f7c0ca88713c7ea330e58a082c89ac Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jul 2021 17:19:10 +0530 Subject: [PATCH 31/35] chore(localization): update readme.md Signed-off-by: xsahil03x --- packages/stream_chat_localizations/README.md | 96 ++++++++++++++++++-- 1 file changed, 86 insertions(+), 10 deletions(-) diff --git a/packages/stream_chat_localizations/README.md b/packages/stream_chat_localizations/README.md index 3ec4d86e..393a414b 100644 --- a/packages/stream_chat_localizations/README.md +++ b/packages/stream_chat_localizations/README.md @@ -1,14 +1,90 @@ -# stream_chat_localizations +# Official Localizations for [Stream Chat Flutter](https://getstream.io/chat/sdk/flutter/) library. -A new Flutter project. +> The Official localizations for Stream Chat Flutter, a service for +> building chat applications. -## Getting Started +[![Pub](https://img.shields.io/pub/v/stream_chat_localizations.svg)](https://pub.dartlang.org/packages/stream_chat_localizations) +![](https://img.shields.io/badge/platform-flutter%20%7C%20flutter%20web-ff69b4.svg?style=flat-square) +![CI](https://github.com/GetStream/stream-chat-flutter/workflows/stream_flutter_workflow/badge.svg?branch=master) -This project is a starting point for a Dart -[package](https://flutter.dev/developing-packages/), -a library module containing code that can be shared easily across -multiple Flutter or Dart projects. -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +**Quick Links** + +- [Register](https://getstream.io/chat/trial/) to get an API key for Stream Chat +- [Flutter Chat Tutorial](https://getstream.io/chat/flutter/tutorial/) +- [Chat UI Kit](https://getstream.io/chat/ui-kit/) + +This package provides localized strings for the stream chat widgets for many languages. + +### Changelog + +Check out the [changelog on pub.dev](https://pub.dev/packages/stream_chat_localizations/changelog) to see the latest changes in the package. + +## Add dependency +Add this to your package's pubspec.yaml file, use the latest version [![Pub](https://img.shields.io/pub/v/stream_chat_localizations.svg)](https://pub.dartlang.org/packages/stream_chat_localizations) +```yaml +dependencies: + stream_chat_localizations: ^latest_version +``` + +You should then run `flutter packages get` + +### Usage +```dart +import 'package:flutter/material.dart'; +import 'package:stream_chat_localizations/stream_chat_localizations.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + // Add all the supported locales + supportedLocales: const [ + Locale('en'), + Locale('hi'), + Locale('fr'), + Locale('it'), + ], + // Add GlobalStreamChatLocalizations.delegates + localizationsDelegates: GlobalStreamChatLocalizations.delegates, + builder: (context, widget) => StreamChat( + client: client, + child: widget, + ), + home: StreamChannel( + channel: channel, + child: const ChannelPage(), + ), + ); + } +} +``` + +### ⚠️ Note on **iOS** +For translation to work on **iOS** you need to add supported locales to +`ios/Runner/Info.plist` as described [here](https://flutter.dev/docs/development/accessibility-and-localization/internationalization#specifying-supportedlocales). + +Example: + +```xml +CFBundleLocalizations + + en + nb + fr + it + +``` + +## Contributing + +We welcome code changes that improve this library or fix a problem, +please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. +We are pleased to merge your code into the official repository. +Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. +See our license file for more details. From ccd748a93602791289ab3d1625e29e0a22b5a8cc Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 26 Jul 2021 10:38:42 +0200 Subject: [PATCH 32/35] bump version and changelog --- packages/stream_chat_localizations/CHANGELOG.md | 4 ++-- packages/stream_chat_localizations/pubspec.yaml | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md index 41cc7d81..5ca6d89e 100644 --- a/packages/stream_chat_localizations/CHANGELOG.md +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 1.0.0 -* TODO: Describe initial release. +* First release diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index ac999a9c..4ef1ce69 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -1,7 +1,9 @@ name: stream_chat_localizations -description: A new Flutter project. -version: 0.0.1 -homepage: +description: The Official localizations for Stream Chat Flutter, a service for building chat applications +version: 1.0.0 +homepage: https://github.com/GetStream/stream-chat-flutter +repository: https://github.com/GetStream/stream-chat-flutter +issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: sdk: ">=2.12.0 <3.0.0" From 24bb8ced541978d5b433450b929a853c1e4710cf Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 28 Jul 2021 15:24:19 +0530 Subject: [PATCH 33/35] chore(ui): fix merge changes Signed-off-by: xsahil03x --- packages/stream_chat_flutter/lib/src/visible_footnote.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/visible_footnote.dart b/packages/stream_chat_flutter/lib/src/visible_footnote.dart index bbdb9144..8d16ce41 100644 --- a/packages/stream_chat_flutter/lib/src/visible_footnote.dart +++ b/packages/stream_chat_flutter/lib/src/visible_footnote.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/src/extension.dart'; /// Widget for displaying a footnote class VisibleFootnote extends StatelessWidget { @@ -19,7 +20,7 @@ class VisibleFootnote extends StatelessWidget { ), const SizedBox(width: 8), Text( - 'Only visible to you', + context.translations.onlyVisibleToYouText, style: chatThemeData.textTheme.footnote .copyWith(color: chatThemeData.colorTheme.textLowEmphasis), ), From 05e3ca1c48eef39b63d662f21160c457fa19db14 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 28 Jul 2021 15:30:11 +0530 Subject: [PATCH 34/35] chore(persistence): update schema version Signed-off-by: xsahil03x --- .../stream_chat_persistence/lib/src/db/moor_chat_database.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_persistence/lib/src/db/moor_chat_database.dart b/packages/stream_chat_persistence/lib/src/db/moor_chat_database.dart index 447533e0..7f5bd4d0 100644 --- a/packages/stream_chat_persistence/lib/src/db/moor_chat_database.dart +++ b/packages/stream_chat_persistence/lib/src/db/moor_chat_database.dart @@ -51,7 +51,7 @@ class MoorChatDatabase extends _$MoorChatDatabase { // you should bump this number whenever you change or add a table definition. @override - int get schemaVersion => 4; + int get schemaVersion => 5; @override MigrationStrategy get migration => MigrationStrategy( From 1107d99076bcaa3b705a2d9bd9fca4e7997876a2 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 28 Jul 2021 12:12:31 +0200 Subject: [PATCH 35/35] update readmes --- README.md | 3 +++ packages/stream_chat_flutter/README.md | 1 - packages/stream_chat_localizations/README.md | 25 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 293f60f6..6758b189 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,9 @@ This package provides business logic to fetch common things required for integra ### [stream_chat_flutter](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter) This library includes both a low-level chat SDK and a set of reusable and customizable UI components. +### [stream_chat_localizations](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_localizations) +This library includes a set of localization files for the Flutter UI components. + ## Flutter Chat Tutorial The best place to start is the [Flutter Chat Tutorial](https://getstream.io/chat/flutter/tutorial/). diff --git a/packages/stream_chat_flutter/README.md b/packages/stream_chat_flutter/README.md index 41ea079d..e79c4b42 100644 --- a/packages/stream_chat_flutter/README.md +++ b/packages/stream_chat_flutter/README.md @@ -15,7 +15,6 @@ - [Flutter Chat Tutorial](https://getstream.io/chat/flutter/tutorial/) - [Chat UI Kit](https://getstream.io/chat/ui-kit/) - ### Changelog Check out the [changelog on pub.dev](https://pub.dev/packages/stream_chat_flutter/changelog) to see the latest changes in the package. diff --git a/packages/stream_chat_localizations/README.md b/packages/stream_chat_localizations/README.md index 393a414b..49fd4442 100644 --- a/packages/stream_chat_localizations/README.md +++ b/packages/stream_chat_localizations/README.md @@ -20,7 +20,18 @@ This package provides localized strings for the stream chat widgets for many lan Check out the [changelog on pub.dev](https://pub.dev/packages/stream_chat_localizations/changelog) to see the latest changes in the package. +## Supported languages + +At the moment we support the following languages: +- [English](https://pub.dev/documentation/stream_chat_localizations/latest/stream_chat_localizations/StreamChatLocalizationsEn-class.html) +- [Hindi](https://pub.dev/documentation/stream_chat_localizations/latest/stream_chat_localizations/StreamChatLocalizationsHi-class.html) +- [Italian](https://pub.dev/documentation/stream_chat_localizations/latest/stream_chat_localizations/StreamChatLocalizationsIt-class.html) +- [French](https://pub.dev/documentation/stream_chat_localizations/latest/stream_chat_localizations/StreamChatLocalizationsFr-class.html) + +More languages will be added in the future. Feel free to [contribute](https://github.com/GetStream/stream-chat-flutter/blob/master/CONTRIBUTING.md) to add more languages. + ## Add dependency + Add this to your package's pubspec.yaml file, use the latest version [![Pub](https://img.shields.io/pub/v/stream_chat_localizations.svg)](https://pub.dartlang.org/packages/stream_chat_localizations) ```yaml dependencies: @@ -30,6 +41,7 @@ dependencies: You should then run `flutter packages get` ### Usage + ```dart import 'package:flutter/material.dart'; import 'package:stream_chat_localizations/stream_chat_localizations.dart'; @@ -65,7 +77,20 @@ class MyApp extends StatelessWidget { } ``` +### Adding a new language + +To add a new language, you need to create a new class extending `GlobalStreamChatLocalizations` and create a delegate for it adding it to the `delegates` array. + +Checkout [this example](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/example/lib/add_new_lang.dart) to see how to add a new language. + +### Override exisiting languages + +To override an existing language, you need to create a new class extending that particular language class and create a delegate for it adding it to the `delegates` array. + +Checkout [this example](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/example/lib/override_lang.dart) to see how to override an existing language. + ### ⚠️ Note on **iOS** + For translation to work on **iOS** you need to add supported locales to `ios/Runner/Info.plist` as described [here](https://flutter.dev/docs/development/accessibility-and-localization/internationalization#specifying-supportedlocales).