Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to view/check loaded locales and their messages? #910

Open
EngelPika32 opened this issue Jan 5, 2021 · 0 comments
Open

Any way to view/check loaded locales and their messages? #910

EngelPika32 opened this issue Jan 5, 2021 · 0 comments

Comments

@EngelPika32
Copy link

Hello,

although I don't think there is a way from what I have seen, I might be wrong.

This would be useful in two ways for me:

  1. I'd be able to check whether a message exists (at all and/or in a given language).
  • Fallback to the user's second language before/instead of the normal fallback to the root
  • Helpful for user-generated content that can be translated directly by others (Though, there are other ways for this.)
  • Iterating through a number of strings without knowing their number.
    ex.: Showing all possible values for an option. As I don't have to store the selected value, I have no point in using ids.
{
  "root": {
    "possibleValues": {
       "egg": "egg",
       "cookie": "cookie",
       "pizza": "pizza"
    }
  }
}
  1. Debugging and finding correct locales.
  • I sometimes struggle to know where which locale can be found. Looking into the live-objects would help a lot.
  • ex. At some point, strings were added under de-DE. Late then under de-CH.
    Now, some from de-CH aren't in de-DE and vice versa.
    de doesn't exist or is blank {} (which is okay, because it's never "asked"/needed).
    Afaik there is no 'good' way for them to fall back to each other (or having 'de' use both). And a "hack" isn't a preferable way.
    Therefore I'd like to track down such strings and merge them into each other (thus, having both locales a complete set of German strings).

Being able to inspect them while being in the debugger would be enough, I suppose.

(Note: I probably should check my writing tomorrow. I'm a bit tired from resolving all E_MISSING_MESSAGE_BUNDLE and E_MISSING_MESSAGE issues (gn8 for myself for now). Mostly caused by Issue 852 - open
I dug as deep as I could and came across my wish (above^) from some weeks ago when I first implemented globalizejs.)

Almost forgot:
Environment: nodejs (v13, v14, v15)
globalize: v1.6.0
cldrjs: v0.5.5

// I'm loading:
globalize.load(
    require("cldr-data/supplemental/likelySubtags.json"),
    require("cldr-data/supplemental/plurals.json"),
    require("cldr-data/supplemental/ordinals.json")
);
@EngelPika32 EngelPika32 changed the title Any way to view loaded locales and their messages? Any way to view/check loaded locales and their messages? Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant