Fallback to langcode if locale unknown
See original GitHub issueThere are few situations, which covers following issue:
-
Numbro won’t try to match langcode in case full locale is unknown
Let’s say we have locale
es-ARG
. Numbro doesn’t have such locale and thus will throw error about unknown locale, but it can at least try to match langcode (es
). In some very rare scenarios it isn’t best approach, but it will work for most cases. It’s better then receive unformatted value. -
Numbro will ignore locales, which consists only from langcode. For example,
ru
is same asru-RU
. Numbro won’t acceptru
as locale name, despite it’s perfectly valid. -
Sometimes we want to provide just langcode and let fortune decide for which exactly country formatting should be picked up — for most languages it’s ok
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Spring MVC: Fallback for unknown language code in uri ...
My suggestion would be to subclass the SessionLocaleResolver and override the getLocale method: @SpringBootApplication public class ...
Read more >Error if folder doesn't exist when using fallbackLng #1941
We should first check whether the folder exists before reading from it. If default locale is specified, and its folder doesn't exist, fallback...
Read more >Locale | Android Developers
Returns the name of this locale's language, localized to locale . If the language name is unknown, the language code is returned.
Read more >API - i18next documentation
An error can occur if for example there was a loading issue when using a backend plugin. i18next.init({. fallbackLng: 'en',. ns: ['file1', 'file2'],....
Read more >locale.module - Backdrop CMS Documentation
Add language handling functionality and enables the translation of the user interface to languages other than English. When enabled, multiple languages can ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We may keep it, it’s still under discussion 😄
How it works is:
ru-*
en-US
*-BR
en-US
Hope it helps
@timmcintosh one way to hard code the behaviour we want is to make an alias like this:
I’m leaning towards us doing this kind of thing instead of spending too much effort changing the fallback code to make it more complex.