Skip to content

Adding Translations

Raphii edited this page Nov 24, 2023 · 25 revisions

In order to allow as many people as possible to use OyasumiVR, it supports multiple languages out of the box. Most of the languages that are supported are community contributions by volunteers. While we try our best together to keep the translations up to date for every language, they sometimes get out of date as OyasumiVR gets developed further, resulting in missing translations.

If you are interested in helping out, either by contributing missing translations, improving our current translations, or even adding support for an entirely new language, you're in the right place! Any and all help is very much appreciated. The more languages OyasumiVR can support, the bigger the chance that more people from various places world wide can use it: My personal goal for OyasumiVR has been for it to help as many people as possible. Below you can read how the process of contributing works:

1. How to get started

First of all, regardless of what you want to do, you're going to have to start by installing the latest development build of OyasumiVR. If you already have the standalone release build installed, you can just install this development build right over it.

The development build contains all the latest changes, so by using this build you can be sure you're working with the most up to date language files.

2. Launch the translation editor

Once you've started the new development build you've just installed, you can find the translation editor under Settings -> Advanced -> Translation Editor. Click "Launch Editor".

From here, how to proceed should be fairly self-explanatory:

  • If you want to edit or add translations for an already supported language, select it from the dropdown. You can then choose to download the most recent version of those translations, or to open a file for that language which you've previously saved to continue where you left off.
  • If you want to add translations for a language that is not supported yet, enter the two-letter ISO 639-1 identifier and do the same thing!

3. Translating

From here, you can start translating!

You'll notice that the editor might already give you some suggestions for some translations from the get-go. Use these to your advantage! As you complete more translations, you can have the editor check again to see if it can use your new translations to pre-fill any other keys that still have to be translated.

If there's a lot to translate, make sure to export plenty to ensure you don't lose any progress. You can always export, and open the file again later to continue where you left off.

If in the time you're translating new changes to the translations are released, you can update your current translations by clicking the "update" button: This will download a new language file, and merge your local changes into it so you're all up-to-date again!

Special tokens

Some translations might contain special syntax or tokens to support certain features:

  • HTML Links (Anchor tags)
  • HTML line breaks (<br> or <br/>)
  • Standard line breaks (\n)
  • Pluralisation tokens

These can require some special treatment when translating. Below you'll find an explanation of each. If any of these give you difficulty, please feel free to ask in the Discord and we'll gladly help you out!

HTML Links

It is important that links are preserved in any translations, as they allow users to click to navigate to other parts both inside and outside OyasumiVR. These links will likely all be anchor tags. Please wrap the relevant parts of your translation in the same tag that you'll find in the English version, so that the link remains intact.

Line breaks

In some translations you'll come across some line breaks. They'll appear in two forms: HTML line breaks, which either look like <br> or <br/>, or standard line breaks, which appear like \n. Effectively, they are the same. These tokens push the text that come after them, to the next line.

They are used to make sure the formatting looks alright in OyasumiVR's UI. When you see them, make sure to pay attention to how the text flows when you are testing your translation. In your translation, they might have to appear in a different location, or can be removed entirely, depending on how it looks.

Not every translation key supports either line break type, or line breaks at all. If the English source translation uses a HTML line break, you're better off using HTML line breaks in your translation too. The same goes for standard line breaks. If the key you're translating does not support line breaks at all but you'd like to use line breaks in your translation, shoot me a message on Discord so I can add support for it!

Pluralisation

In some cases, you might need to handle pluralisation. Often, in the case of many Asian languages, this can be ignored. Some languages, like English, do need some pluralisation (e.g. "1 second" vs "2 seconds"). For other languages, like Russian, there can be even more pluralisation categories.

To support this, OyasumiVR's translations support Unicode's ICU syntax. You can find some simple documentation on this syntax here. You'll see that some of the English translation's values use this syntax in order to support pluralisation. For a reference on exactly which pluralisation categories your language supports that you can use, check Unicode's table on pluralization rules for any category that has a cardinal type.

4. Testing your translations

Now that you have added your translations, you're going to want to test them. To do this, save the JSON file for your language somewhere and open OyasumiVR.

Next, in OyasumiVR, go to Settings -> Advanced -> Load translation file, and click the Load File button. If you select the JSON file you saved, OyasumiVR will attempt to load it.

Now you can start checking your translations. See if there are any parts you might have missed, if all text flows correctly, if all the line breaks are in the right places and if you updated any links that they are still working. Basically just check if everything is formatted correctly. If you find any errors, you can just go back to update your translations and load the file again!

For now, please note that testing date formatting and pluralization is not currently possible in this mode.

5. Submit your new translations

If you've made it this far, thank you so much! It is time to submit your translations. There are several ways to do this.

  • If you're familiar with Git(Hub), you can submit your translations by making a Pull Request.
  • You can submit an issue right here on GitHub and include the file.
  • You can contact me on Discord. You can either do so in the Discord Server, or you can DM me at @raphiiko.
  • Send me the file by email.

If you are a first time contributor, please let me know:

  1. What name you want to be credited as
  2. Your Twitter handle, if you have a Twitter account (for giving credit)
  3. Your GitHub username/email, if you have a GitHub account (for giving credit / to add as a co-author to any git commits)

Final Words

I can't give anything but my thanks to the people who choose to spend their time on this project. Thanks to this fantastic bunch of volunteers (hopefully soon including you!), more people are able to make use of OyasumiVR than would otherwise have been possible. I am incredibly grateful for that, and I hope this will keep improving more and more as time goes on.

If you're willing and looking to help us out, I very much hope to hear from you soon!


Deprecated steps (That you can still use for now)

[Deprecated] 2a. I want to add support for a new language

Open the OyasumiVR Language Template Downloader, and under Option B, click Download fresh template.

image

This will give you a fresh template file to work with. If you open it up, you can see all the keys have {PLACEHOLDER} set as their value. This is what you are going to replace with the translations for the language you're translating to. More details will follow in step 3.

[Deprecated] 2b. I want to add missing translations and/or improve existing translations

Open the OyasumiVR Language Template Downloader, and under Option A, choose the language you want to contribute to, and click Download template.

image

This will give you the language file with all current translations for the language you picked, plus placeholders for any missing translations. If you open it up, you can maybe see that some of the keys have {PLACEHOLDER} set as their value. This is what you are going to have to replace to add missing translations. Any existing translations at other keys can be updated in order to improve them if needed.

[Deprecated] 3. Translating

To know what to translate from, you can get the English example file for reference. You can get this file by again opening the OyasumiVR Language Template Downloader and clicking Download English example.

image

Structurally, this file will be identical to the template you downloaded in step 2a or 2b. The English example file is used as a baseline, and is always up to date with the latest translations. It therefore never has any missing translations, and can be used as a reference to translate from. Additionally, any missing keys for non-English languages will fall back on the English translation if needed.

...Continue with the rest of step 3 above!