Translation

Collider LI edited this page Jan 9, 2018 · 12 revisions


First of all, thank you for being interested in IINA! If you want to contribute and localize this project in your language, please follow the instructions below.

Get Ready to Translate

1. Fork IINA at GitHub and clone your fork

For full git clone or GitHub Desktop usage, please refer to Build the Project.

2. Create a new branch for your localization

Create a new branch from latest develop, and its name should indicate your language.

  • If you are using git:
git checkout -b <branch_name> develop
  • If you are using GitHub desktop:

Type your branch name and create a new branch based on develop.

new branch

3. Build the app

Please refer to Build the Project and get ready to build the app.

Add Translations

1. Add a new localization

new language

Then press Finish directly. Xcode will create a localized copy for each localizable file in the project. If you see a disclosure triangle (▶︎) next to a file in the navigation panel, then it is localizable, and you can check localized versions by clicking it. Typically, xib, strings and Contribution.rtf files are needed to be localized.

2. Translate files

add translations

  • XIB files

    There should be several .strings files under each .xib file. Choose the one in your language and change English expressions in the file into your language.

    You can copy an Object ID, e.g. eCe-SS-Wlj and search it in .xib files using ⌘+F to find the actual object in UI.

  • Strings files

    All .strings files should also be translated. Please refer to the English(Base) version.

    Please take extra care for format strings like "%@" and "%d". IINA will crash on incorrect format strings.

  • Contribution.rtf

    This file will be displayed in About window. It's up to you to translate the GPLv3 statement, but please also keep the English one as it's the only official version.

Please add your Email or github account name in your Contribution.rtf too.

3. Check your translation Automatically

Starting from 1.0, IINA Translation Utility is the recommended way to check for errors or missing keys.

Before 0.0.15, IINA included a script to check whether you missed anything, or probably made any mistake. If you want to utilize it, please firstly add your language in the script, and then under project root folder, run

swift other/check_translation.swift

You may submit the updated check_translation.swift together in your pull request.

4. Test your translations (Advanced)

Build and run the app and see whether everything is displayed properly. Please make sure the preference panel will resize automatically and smoothly for wider content.

Submit your work

1. Commit your work and push to your branch

  • For git:
git add .
git commit -am "<commit message>"
git push

If you have not pushed yet to GitHub

git push --set-upstream origin <branch_name>
  • For GitHub Desktop:

Press Uncommitted Change tab, edit your summary and description (optional). Then commit to your branch.

publish Use Publish button to push your work to GitHub.

2. Submit a new pull request for IINA

Go to the main page of IINA on GitHub. GitHub will prompt you to make a Pull Request using your most recent branch. Press Compare and pull request.

pull request

Make sure to change the base branch into develop.Now the base branch is already develop.

Update Translations

As IINA is updated frequently, please better stay connected and update your translation promptly.

When IINA needs new translation from you, I (@lhc70000) will mention you in github or the Slack group. If I can't receive your response in several days, IINA will release a next version with missing translations 😰. Please check the Translation Status page for progresses, and feel free to update obsolete translations.

Before starting work, please make sure your branch is up-to-date with the develop branch.

1. Check for newly added keys

Now the recommended way to update translations is IINA Translation Utility.

Sadly, Xcode is unable to update an existing strings file, so you must update the file manually. For big changes, please consider recreating the translation file or using other tools.

Usually, I'll provide you newly added keys, but you're recommended to check missing keys by yourself.

2. Translate added keys

For xib files, please just append lines in the strings file in the same format. E.g. for key eCe-SS-Wlj, your should add

eCe-SS-Wlj.title = "Your translation";

You can also search this ID in the corresponding xib file to find the actual UI component.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.