Closed alonstar closed 6 years ago
Hi @lephyrus could we get this merged and released? This is the real fix to issues like #25 and #26.
Hi Guys,
Could you help me in this on :
when i make delete button , i got this error message :
here is my code of delete button :
---- html ---
@lephyrus how about this question? Angular is already 6.1 .
@alonstar Sorry for the late reply, I took a longer vacation. Thanks a lot for finding this solution and writing a test as well. I would like to better understand the exact problem that is being solved here. Is passing the languages to MessageFormat at instantiation time only necessary when using "detailed" language codes ("en-US" vs "en", "de-CH", vs "de")? I know for sure that this is not a general problem that happens always, so I'd like to understand WHEN (and ideally WHY) it occurs. This will help explain to users of the library when and if they need to use the configuration option you've added. Do you know more about this?
Essentially, instantiating MessageFormat without any locales means that it loads all locales for potential later use, and ends up hard-coding them to their base language name. In the constructor, strings passed in as locale names are assumed to be valid BCP47 tags and hence decomposable into their base names that can be matched to locales. In compile(src, lc)
, no such assumption is made. This means that e.g. fi_FI
would not match fi
, and the locale would go to the fallback, which is English by default.
So yeah, we should probably fix this upstream as well, but this fix would also have other benefits for you.
Well, if that isn't as clear and authoritative an answer as I could have hoped for... Thanks for chiming in, and thanks for developing messageformat, @eemeli. Adding an option for specifying the required languages definitely makes sense then. Any chance you already have an "official" explanation of the default behaviour I could link to in the README?
Never mind, it's easy to find, sorry (https://messageformat.github.io/messageformat/MessageFormat). I guess the ensuing problem when using composed locales is what's not intuitive. I'll add a note about it to the README, since people seem to encounter this more often than I would have thought.
Can this be merged then?
Hi @lephyrus could you please merge this and release a new version? Thanks a lot.
If lang is not "en" ("en" is messageformat default language), messageformat will throw errors.
So, I add a languages property in MessageFormatConfig to configure messageformat.