question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow addtional "tokens" in the locale, additional to language and country

See original GitHub issue

Problem

As I was trying to organize some translations, I found myself in the situation that I need to use not only language and country to define the locale, but also a variant.

For example (not the real situation but hopefully to illustrate)

  • de = German
  • de-DE = German / Germany
  • de-DE-bavarian = German / Germany / Bavarian

Using your Beta v2.0 WiP I found, that 3rd locale de-DE-bavarian will not be shown neither in the Progress view nor in the editors popup, where the translations are shown. Only de and de-DE will be visible.

Reference to Java locale

For example in the Java documentation 7 and 8 there are mentioned two “non-conforming locales” ja_JP_JP and th_TH_TH.

Additionally the documentation suggests extensions to the locale, see there.

Another link is this in Table 5. Some of the Supported Locales in java.util and java.text Packages

| Language | Country | Locale ID | | … | … | … | | Thai (Western digits) | Thailand | th_TH | | Thai (Thai digits) | Thailand | th_TH_TH |

Suggested solution

Thus I would suggest, that the locale can be created from a - theoretical endless 😉 - number of tokens, with the only constraint, that

  • the first token defines the language
  • the second token defines the country and is used to retrieve the country flag

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mmokrosscommented, Apr 21, 2020

For a more official use of locale, you can see above

  • th_TH= Thai (Western digits) Thailand
  • th_TH_TH = Thai (Thai digits) Thailand
1reaction
mmokrosscommented, Apr 21, 2020

BTW, can you provide me more information about how you use Java and i18n in VS Code? It’s good for me as a reference to support wider use cases.

Sorry for not being clear enough:

  • At my previous job - years ago, implementing Java with Eclipse - we used the variant part of locale() to localize some vendors text (like item number, #, item#, etc.).
  • Right now I’m playing around on some hobby project - implementing in JS and PHP, and that feature came back into my mind.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Additional Locales of the Same Language to Custom Skills
You can add additional locales of the same language to your custom skills by using one of the following features: Sync locales –...
Read more >
Vue i18n: Building a multi-language app with locale switcher
Vue i18n is a key process needed to localize your Vue apps and websites. Learn how to set up a Vue app with...
Read more >
Retrieve locale based on the Accept-Language in Spring Boot
I'm injecting a MessageSource ms , and programmatically reading messages like: final Locale locale = ??? ms.getMessage("message.duplicate-token" ...
Read more >
Accept-Language - HTTP - MDN Web Docs
The Accept-Language request HTTP header indicates the natural language and locale that the client prefers. The server uses content ...
Read more >
Localizing your app - Angular
Refer to locales by IDlink. Refer to a locale using the Unicode locale identifier (ID), which specifies the language, country, and an optional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found