Jump to content

How to add or modify translations


kurosaki ichigo

Recommended Posts

ntroduction

This guide will cover how you can contribute to the development of OpenBullet 2 without any prior coding knowledge by helping with localizing it in your native language.

First of all you should check if your language is among one of the supported ones. You can do this by looking for the small flag that indicates your currently selected culture in OpenBullet 2 and clicking on it. If your language appears among the choices, please skip the next paragraph.

If your language is not supported then you will have to open an issue 7 on the official repository and ask to implement it. You will need to wait until a developer implements your request before you will be able to follow the next part of the guide.

Getting the source code

In order to get a translation going you will need a github account 5.
Once that’s out of the way, you will need to navigate to the official OpenBullet 2 repository 15 and click on the fork button in the top right corner.
This will create your own copy of the repository on your own github account.

After that, you will need to install git 1 on your computer. If you want, you can also install a git tree graphic visualization tool like sourcetree (which is free).

Once git is installed, open a terminal (for example cmd or powershell on windows) and navigate to a folder where you want your files to be downloaded to. Then type

git clone https://github.com/your-github-username/OpenBullet2

This will copy the repository to your disk so that you can modify the files you need.

Modifying the files

You can add or modify the localization files with any text editor, but I would recommend using Visual Studio as it has a built-in resource file viewer which is very easy to use and will let you avoid writing XML syntax.

Visual Studio

First of all install Visual Studio Community 1 with the standard toolset as we don’t need anything specific in order to just edit resource files. Then open the OpenBullet2.sln file in the root of the folder you just cloned.

Once you’re inside Visual Studio, you will need to use the solution explorer on the right side of your screen to find the file you want to modify, which will have a .resx extension. For example if you wanted to modify a German translation for the Index page you will need to open the Index.de.resx file inside of the Resources/Pages folder inside the OpenBullet2 project.

Step 1: expand the OpenBullet2 project
immagine

Step 2: navigate to the Resources/Pages folder
immagine

Step 3: double click on the Index.de.resx file
immagine

Note: some components are shared between pages and some are forms to fill out. You can edit translations for those too, and you can find them under Resources/Shared and Resources/Shared/Forms respectively.

Modifying a translation

You will then see something like this
immagine

The Name is the identifier for a given localized string, and the Value will be the text that will appear on the screen once a localization is requested. You must only change the Value and never the Name of a row, otherwise the localization provider won’t be able to find it anymore because you changed its identifier and hence it will fall back to English.

Feel free to edit the Value column in this file as you please in order to provide the most accurate translation. If you cannot find a row for a translation you can simply go to the English version of the resource (which will always be kept up to date) and copy-paste it from one file to the other.

The file containing the English translation in this case it will be Index.resx.

Adding a missing translation

If the translation file for your language is nowhere to be found, you can create one by right clicking on the Resources/Pages folder and selecting Add > New Item and looking for a Resource file type (you will see the .resx extension).

Be aware that your file should be named properly otherwise it won’t be found by the localization provider (for example if you’re localizing a Test.resx file in French you will need to create a file called Test.fr.resx in the same folder of the English one).

Then you can select all the rows from the English resource file, copy and paste them to the French file and start replacing the English text in the Value column with its French translation.

Committing your changes

First of all you should check that you saved your modified files. After that, go back to the terminal and type

cd OpenBullet2
git add --all
git commit -m "Localization"

This will add your modification to a commit, which is a new patch to the original source code. You will then need to upload your changes to the remote repository on github by typing

git push origin master

You will be asked for your github credentials (because you and only you can access your github repository at the moment).

Making a pull request

You’re almost done! Now it’s time to close the terminal and go back to the browser. You will need to open the pull requests page 1 of the official OpenBullet 2 repository and click on New pull request.

As a base repository you will need to select the official repository openbullet/OpenBullet2 and the master branch, while for the head repository you must select your own fork, for example testuser/OpenBullet2 and the master branch.

You can then click on create and wait for it to be approved!
Thank you very much for your contribution :heart:

Additional information

If you can’t be bothered to do all of this, you can upload the modified files somewhere and ask someone else on this forum to make a PR in your place. We won’t be mad at you :stuck_out_tongue:

  • Like 2
  • Thanks 1
  • Upvote 1

Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...