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

Multi lang support + minor changes #1

Merged
merged 2 commits into from
Dec 24, 2024
Merged

Multi lang support + minor changes #1

merged 2 commits into from
Dec 24, 2024

Conversation

tommarekCZE
Copy link
Contributor

@tommarekCZE tommarekCZE commented Dec 21, 2024

I wanna contribute to this plugin, I saw the plugin lacks the multi lang support so I added it with minor buxfixes.

  1. Multi lang support, it does consists from TranslationManager.java wich is basically class that handles the multi lang support. It does get load in Lunamatic.class with language name specified in config.yml under "lang". If the plugin fails to find the translation file it would disable the plugin and gives the server operator some trouble shooting tips. The plugin would get disabled even if the translation version missmatches with the version provided in Lanamatic.class. Then the translation token could be accessed with translationManager.getTranslation("example") In order to be synced with the
    Lunamatic lang, on each access for token the translationManager needs to match the current TranslationManager instance.

  2. Improved /luna reload. It does now reload all variables from config.yml, even the language. It does display warning message when executed, that something can go wrong and it should be used only while testing. Because it does reset the TranslationManager instance, the TranslationManager refferences cannot be final!

  3. Fixed that getComponentLogger didn't output any text. Instead that I used getServer().getConsoleSender().sendMessagee(). It does use ChatColor witch is deprecated. I will take look on it in future. But for now it does work.

  4. Allowed so users can use it on another version of Paper, but they are encouraged to do NOT do that, and it could behave unexpectedly or even crash. (Because some plugins work on newer versions)

  5. Removed world from disabledWorlds in default config.yml. It is little bit confusing that main world isn't enabled by default.

How to add more languages?

  • Only translated .yml file needs to be placed into the src/main/resources/translations

  • I introduced only two langs files for start (Czech and English)

  • While translating, the lang_ver needs to be set accordingly to the lang_ver that is defined i Lunamatic.class

  • Everything on loading of the server was tested

  • Translations were tested

  • /luna reload was tested

  • 20 mins test was performed and there wasn't any issue present.

  • 24h test (I would try it today, while pushing it on my server for my friends)

Copy link
Owner

@Ifiht Ifiht left a comment

Choose a reason for hiding this comment

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

Excellent translation - I like the blood moon no sleep msg in Czech ;)
Thanks for all this work.

@Ifiht Ifiht merged commit def3de1 into Ifiht:main Dec 24, 2024
1 of 2 checks passed
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.

2 participants