Coder Social home page Coder Social logo

Comments (6)

marcglasberg avatar marcglasberg commented on August 17, 2024 1

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.

marcglasberg avatar marcglasberg commented on August 17, 2024 1

Yes, I'll make it case insensitive. Thanks!

from i18n_extension.

marcglasberg avatar marcglasberg commented on August 17, 2024

Yes, I believe these messages should not be displayed. I should fix this.

from i18n_extension.

crizant avatar crizant commented on August 17, 2024

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.

LaysDragon avatar LaysDragon commented on August 17, 2024

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.

LaysDragon avatar LaysDragon commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.