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

In _constants.ts, LANGUAGE codes shouldn’t be mixed #22

Closed
Moonbase59 opened this issue Jul 21, 2021 · 6 comments
Closed

In _constants.ts, LANGUAGE codes shouldn’t be mixed #22

Moonbase59 opened this issue Jul 21, 2021 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@Moonbase59
Copy link

In _constants.ts, there is a mixture of codes for language, like

    "en_US": "English (US)",
    "en_GB": "English (UK)",
    "pt-BR": "Brazilian Portuguese",

Some are using an underscore _ as separator between language and country, some use a hyphen -. Although some OSes use the underscore, I’d suggest using RFC 5646 codes instead (those with a hyphen).

For non-English speakers it might also be nice to use localized language names, like the Obsidian language selector does. Example:

export const LANGUAGES = {
    "en_US": "English (US)",
    "hi": "हिन्दी",
    "es": "Español",
    "fr": "Français",
    "ja": "日本語",
    "ru": "Русский",
    "en_GB": "English (UK)",
    "de": "Deutsch",
    "it": "Italiano",
    "ko": "한국어 (韓國語), 조선말 (朝鮮語)",
    "pt-BR": "Português do Brasil",
    "ar": "اَلْعَرَبِيَّةُ‎",
    "tr": "Türkçe"
}
@phibr0
Copy link
Owner

phibr0 commented Jul 21, 2021

Looks good, would you like to open a PR for this? Also changing the way the Language Codes are handled might bring issues with already existing caches.

@phibr0 phibr0 added the enhancement New feature or request label Jul 21, 2021
@Moonbase59
Copy link
Author

Sure, caches might be corrupted. Plus, I don’t know if any upstream code or APIs already use the "wrong" language codes. I suspect at least the Free Dictionary API might.

Haven’t done PRs for ever so long, and I’m not too fluent with Typescript/Javascript, so I fear I might mess things up, especially since I’m quite short on time currently. Maybe I should better leave it to you, since you know your code much better …

@Moonbase59
Copy link
Author

Just for the fun of it: If I was to try a PR, how would the build environment look like (i.e., what’s to install on a Linux, Debian-type, system)? And how to build (in order to test the changes before making a PR)?

Is there any good documention for building Typescript Obsidian plugins you could link me to?

@phibr0
Copy link
Owner

phibr0 commented Jul 22, 2021

You can read about how to get started here: https://github.com/obsidianmd/obsidian-sample-plugin

There currently isn't much documentation (it will probably come after Obsidian 1.0) except the Obsidian Definition File https://github.com/obsidianmd/obsidian-api . If you need help your best bet will be the Obsidian Discord, which you can find on their Website.

@Moonbase59
Copy link
Author

Thanks for these! If I get some spare time, I’ll give it a spin …

phibr0 added a commit that referenced this issue Jul 22, 2021
@phibr0 phibr0 closed this as completed in 73519ff Jul 22, 2021
@phibr0
Copy link
Owner

phibr0 commented Jul 22, 2021

The Languages Codes are like that because initially the Plugin was only using the https://freedictionaryapi.dev which was using these Codes. I agree that this is pretty unfortunate and I will fix this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants