Ember-intl: Ability to silence "ICU argument missing" warnings for missing/non-translated keys

Created on 3 Apr 2020  路  4Comments  路  Source: ember-intl/ember-intl

  • [x] I am on the latest ember-intl version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate

Environment

  • Ember Version: 3.9.0
  • Ember CLI Version: 3.9.0
  • Ember Intl Version: 4.2.4
  • Browser(s): N/A
  • Node Version: 13.11.0

Steps to Reproduce

  1. Using requiresTranslation in ember-intl.js config to silence missing translations for the non-default locale works fine

        module.exports = function() {
            return {
                disablePolyfill: true,
                publicOnly: true,
                requiresTranslation(key, locale) {
                    return locale === 'en-us';
                }
            };
        };
    
  2. If the en-us translation uses arguments in a translation key and the other locales are not translated then "ICU argument missing warnings" appear for the key

  3. Building the ember application spams the build log with over a thousand lines of ICU warnings (I have ~55 translation files with most in the early stages/less than 10%)
  4. Valid errors in en-us or locale translation mistakes are buried

I've read through the docs but haven't stumbled upon anything that would achieve this.

en-us.yaml

timeUnits:
  years: "{count, plural, =1 {year} other {years}}"
string: "Example"

es-es.yaml

string: "Ejemplo"

build output

[ember-intl] "timeUnits.years" ICU argument missing: "es-es": "count"

image

enhancement

Most helpful comment

This will be resolved in the next 5.0.0 prerelease

Thanks @sandstrom

https://github.com/ember-intl/ember-intl/pull/1224

All 4 comments

https://github.com/ember-intl/ember-intl/pull/1180 is trying to solve this. I don't yet have an API in mind for it - feel free to propose one.

This will be resolved in the next 5.0.0 prerelease

Thanks @sandstrom

https://github.com/ember-intl/ember-intl/pull/1224

Reopening because the current implementation has issues & we'll need to tackle it differently.

In retrospect, requiresTranslation should not have been used in two different contexts (mismatch arguments and missing translations). A new hook will need to be added - and I'm not a fan of adding more options for the linter in the configs current form. I want to rethink the linting config API - which will need to happen in 6.0.0 because it will likely involve breaking changes.

My incoming fix to 5.x will make ensure that ICU argument mismatch warnings no longer are emitted for translations that are missing. requiresTranslation will not have any baring on mismatched arguments.

cc @sandstrom

5.0.7 corrects the behavior.

Was this page helpful?
0 / 5 - 0 ratings