Comments (6)
You can disable recording this, by doing:
Translations.recordMissingKeys = false;
Translations.recordMissingTranslations = false;
You can also set up callbacks that the i18n_extension package will call whenever it detects a missing translation. You can then choose when to log or not, by creating your own logic. To do that, simply inject your callbacks into Translations.missingKeyCallback
and Translations.missingTranslationCallback
. For example:
Translations.missingTranslationCallback = (key, locale) => doSomething();
from i18n_extension.
Yes, I'll make it case insensitive. Thanks!
from i18n_extension.
Yes, I believe these messages should not be displayed. I should fix this.
from i18n_extension.
I think these messages is useful when you provided en_US
only but the selected locale is en_UK
.
To suppress these errors you may limit the locale to Locale('en')
and Locale('de')
only.
But it also makes sense if @marcglasberg can add an option to hide these errors when the language matched.
from i18n_extension.
I bump into this problem too,but I'm using code zh_TW
and en_US
. It just keep complaining about missing translation in en_us
and zh_tw
even through it actually works fine. It seems there is some problem for internal logic to match the standards code.
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "帳號".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "請輸入您的信箱".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "密碼".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "忘記密碼?".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "註冊".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "登入".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "帳號".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "請輸入您的信箱".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "密碼".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "忘記密碼?".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "註冊".
I/flutter ( 1682): ➜ There are no translations in 'en_us' for "登入".
I'm trying to switch to lowercase code but when I pass invalid local to supportedLocales now it will report error and focus me to use the standard code mentioned in #14.
MaterialApp(
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en', "us"),
Locale('zh', "tw"),
],
)
The following assertion was thrown building MediaQuery(MediaQueryData(size: Size(392.7, 802.9), devicePixelRatio: 2.8, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets(0.0, 24.0, 0.0, 0.0), viewPadding: EdgeInsets(0.0, 24.0, 0.0, 0.0), viewInsets: EdgeInsets.zero, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false, navigationMode: traditional, gestureSettings: DeviceGestureSettings(touchSlop: 8.0))):
Flutter does not support the non-standard locale form en_us (which might be en_US
'package:flutter_localizations/src/material_localizations.dart':
Failed assertion: line 732 pos 9: 'locale.toString() == localeName'
The relevant error-causing widget was:
MaterialApp MaterialApp:file:///D:/Coding/Laysi/outsourcing/2021.11.29-ncku-orienteering/project/lib/main.dart:277:12
When the exception was thrown, this was the stack:
#2 _MaterialLocalizationsDelegate.load.<anonymous closure> (package:flutter_localizations/src/material_localizations.dart:732:9)
#3 _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:453:23)
#4 _MaterialLocalizationsDelegate.load (package:flutter_localizations/src/material_localizations.dart:727:32)
#5 _loadAll (package:flutter/src/widgets/localizations.dart:55:49)
#6 _LocalizationsState.load (package:flutter/src/widgets/localizations.dart:532:62)
#7 _LocalizationsState.initState (package:flutter/src/widgets/localizations.dart:497:5)
#8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4728:57)
#9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4561:5)
#10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3631:14)
#11 Element.updateChild (package:flutter/src/widgets/framework.dart:3380:20)
#12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4613:16)
#13 Element.rebuild (package:flutter/src/widgets/framework.dart:4311:5)
#14 ProxyElement.update (package:flutter/src/widgets/framework.dart:4943:5)
#15 Element.updateChild (package:flutter/src/widgets/framework.dart:3370:15)
...ignored
env:
i18n_extension version: 4.2.0
Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (10 weeks ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1
from i18n_extension.
Thanks but I still need the missing translation report to find out if I have missing any translation. Later I found out I need to use whole lowercase code in my translation to stop the warning. It's kind of confusing people because config and translation code
required format isn't match.
I suggest to compare code case insensitive in internal check flow to avoid this kind of problem. :D
from i18n_extension.
Related Issues (20)
- Error "Translation key in 'en_us' is missing: [...]" while using custom modifiers
- Issue with updating the app language accross the app from the child widget to ancestor widget. HOT 3
- I can't seem to make it work with async_redux. HOT 1
- Support Analyzer 4 HOT 2
- Incorrect plural forms from po files HOT 2
- "Translation key in 'en' is missing..." logs in my debug console HOT 2
- mark a string for getstrings but don't actually translate HOT 8
- We need to update the intl dependency HOT 6
- JSONImporter and getStrings was moved outside of the lib directory. HOT 10
- build fail with v8.0.0 HOT 6
- EXCEPTION CAUGHT BY WIDGETS LIBRARY when running a test HOT 4
- Use intl 0.18.0 HOT 11
- What happened to the JSONImporter? HOT 4
- Error on import package:i18n_extension/io/import.dart in version 9.0.0 HOT 2
- How to use with po files? HOT 4
- Could not find bin/getstrings.dart in package i18n_extension. HOT 1
- There are no translations in 'en_us' HOT 2
- [v11.0.11] Method signature suggestion HOT 1
- Problem with Flutter 3.22.0 HOT 2
- With Flutter 3.22.0 the I18n() widget results in a blank screen on web and disables all gestures on other platforms (iOS, Android, etc.) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from i18n_extension.