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

Localize HeliosLauncher UI using lang files #301

Merged
merged 29 commits into from
Oct 5, 2023

Conversation

Kamesuta
Copy link
Contributor

@Kamesuta Kamesuta commented Sep 2, 2023

This pull request adds the following features:

  • Externalize the UI text into lang files and replace them with embedded codes using LangLoader.
    • In ejs files, use the ejs output tag (<%- lang('~') %>) syntax.
  • Support argument expansion in LangLoader. Expand the object in the second argument from {placeHolder}.
  • Replace json with toml for easier element addition and indentation.
    • If you don't like toml, you can revert the last commit to go back to json.

@dscalzi dscalzi self-requested a review September 2, 2023 20:05
@dscalzi
Copy link
Owner

dscalzi commented Sep 2, 2023

I will take a look, this would be a very nice addition

@luisBazanDev
Copy link

It is a very good implementation, I hope you can accept it as soon as possible so I can do the translation into Spanish.

@Codixer
Copy link

Codixer commented Sep 24, 2023

I wonder the state of this 0_0

@Kamesuta
Copy link
Contributor Author

Kamesuta commented Sep 26, 2023

Updated: Added cascadable language system for easy customization by launcher forkers.

  • Translators can now change the language by simply adding a file like ja_JP.toml and uncommenting //exports.loadLanguage('xx_XX') in langloader.js.
    • You can add only the text you wish to translate to the language file you have added. For items that are not written, the default en_US text will be used
    • This change is ready to accept Pull Requests to add toml files for various languages
  • I have separated the following two files that have nothing to do with translation into separate files
    • _placeholder.toml for texts that do not require translation (such as placeholder news article, and default overlay description)
    • _custom.toml for launcher customizer (such as app title, github url, and welcome description)

@dscalzi
Copy link
Owner

dscalzi commented Oct 5, 2023

Sorry this has taken a while, mostly looks good - I just need to checkout the branch and test a few things.

index.js Outdated Show resolved Hide resolved
app/assets/lang/en_US.toml Outdated Show resolved Hide resolved
Copy link
Owner

@dscalzi dscalzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, may tweak more later.

@dscalzi dscalzi merged commit 9d80d3b into dscalzi:master Oct 5, 2023
san-antonio0978 pushed a commit to Stargate-Atohara/StargateAtoharaLauncher that referenced this pull request Feb 29, 2024
* First step to use Language .json file in ejs

* i18n for landing.ejs

* i18n for login.ejs

* i18n for loginOptions.ejs

* i18n for overlay.ejs

* i18n for settings.ejs

* i18n for waiting.ejs

* i18n for welcome.ejs

* langloader.js placeholder support

* i18n for landing.js

* i18n for login.js

* i18n for overlay.js

* i18n for settings.js

* i18n for uibinder.js

* i18n for uicore.js

* remove html language replacement

* use toml for i18n

* Fix mojang/microsoft status icon is undefined

* cascadable langloader

* separate lang file for customization

* move some placeholder text to _placeholder.toml

* Update

* Reduce package lock diff.

* Remove another placeholder.

* Checkbox does not require translation.

* Icons don't need translation.

* Leave placeholders inline.

* Fix translation for news pages.

* Remove more unneeded translations.

---------

Co-authored-by: Daniel Scalzi <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants