Git Product home page Git Product logo

Comments (4)

ijlee2 avatar ijlee2 commented on June 22, 2024 1

Will close the issue, as @formatjs/intl is correctly handling the case of an empty message key by throwing the error [@formatjs/intl] An id must be provided to format a message.. I wrote a test in #1889 to document this case.

from ember-intl.

gzurbach avatar gzurbach commented on June 22, 2024

@IgnaceMaes I am still on 5.7.2 of ember-intl but maybe this would help?

In config/ember-intl.js, have you tried setting the following config key:

errorOnMissingTranslations: false

Hope it helps!

from ember-intl.

IgnaceMaes avatar IgnaceMaes commented on June 22, 2024

Even with that option disabled it still throws the error at runtime.

For now I've been extending the t helper and setting the allowEmpty flag on true to have the same behaviour as in versions 5.x.

import Helper from 'ember-intl/helpers/t';

export default class extends Helper {
  allowEmpty = true;
}

from ember-intl.

ijlee2 avatar ijlee2 commented on June 22, 2024

@IgnaceMaes I confirmed that, in 6.0.0-beta.7, a runtime error occurs when we try to render a page with the translation {{t ""}}.

-format-base.js:40 Uncaught Error: <hello-world@helper:t::ember90> helper requires value attribute.
    at _default.compute (-format-base.js:40:1)
    at ClassicHelperManager.getValue (index.js:2484:1)
    at manager.js:300:1
    at reference.js:136:1
    at track (validator.js:635:1)
    at valueForRef (reference.js:135:1)
    at Object.evaluate (runtime.js:3269:1)
    at AppendOpcodes.evaluate (runtime.js:1052:1)
    at LowLevelVM.evaluateSyscall (runtime.js:4214:1)
    at LowLevelVM.evaluateInner (runtime.js:4185:1)

However, I'm hesitant to consider the issue a bug or regression. To my understanding, allowEmpty hadn't been set to true for the {{t}} helper. We can see this by the absence of allowEmpty in addon/helpers/t.js and addon/helpers/t.d.ts.

Because of another change in behavior (missing setupIntl() in a test now errors in 6.0.0-beta.x, whereas the test would run in 5.7.2), it feels like to me that the app (or possibly ember-intl) might have accidentally been too forgiving (possibly due to outdated dependencies of ember-intl). Instead of letting the app continue to run, it's probably better to throw an error or not build, so that developers know early that something that they assumed isn't correct.

Can you help me understand your case? I didn't quite understand how we might have {{t ""}} or {{t undefined}}.

from ember-intl.

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.