wilinz / globalization-translator

Intellij platform i18n plugin,Generate 131 languages ​​for your application with one click,Support Android strings.xml and java properties file
GNU General Public License v3.0
16 stars 2 forks source link

GlobalizationTranslator

简体中文文档

Intellij platform i18n plugin,Auto translate 131 languages for your application with one click,Support Android strings.xml and java .properties file

This plugin supports translate Android.xml and java .properties file, which can preserve the placeholders such as %1$s, %2$d, {0},{1} and can Reserved escape characters like \n,\",\', etc., support string, string-array, plurals tag.

Advantages of this plugin compared to other plugins: fast translation speed, translate files into 131 languages in less than two minutes, support for retaining placeholders, support for incremental translation.

Install

Intellij platform -> Settings -> Plugins -> Marketplace -> Search "GlobalizationTranslator" -> Install
or
Download GlobalizationTranslator.zip from here -> Settings -> Plugins -> Click Settings Icon Button -> Install Plugin form Disk

Dependency:Compose for IDE Plugin Development (Experimental)

Download Dependency

1. Intellij Version >= 213:
Settings -> Plugins -> Marketplace -> Search "Compose for IDE Plugin Development (Experimental)" -> Install 2. Intellij Version < 213:
Click Here Download -> Settings -> Plugins -> Click Settings Icon Button -> Install Plugin form Disk

Usage

  1. Translate the entire document
    1. Select the values/strings.xml or .properties file
    2. Right click and select "Translate this file".
    3. Select the languages to be translated.
    4. Click OK.
  2. Incremental translation
    1. In the values/strings.xml or .properties file, select n lines of content you want to translate
    2. Right click and select "Translate to Other Languages".
    3. Select the languages to be translated.
    4. Click OK.

Skill

After translating Android strings.xml, many values-** folders will be generated, which is very confusing. At this time, we can create a new folder in the app/main directory and name it at will, such as res-i18n , Then create a new values directory in the res-i18n directory, and copy the previous res/value/strings.xml to the values directory Then edit build.gradle , add res.srcDirs += "src/main/res-i18n" under sourceSets/main, where res-i18n is the name of the newly created folder, and then click gradle sync. After that, the files generated by the translation are all in the res-i18n directory, which looks a lot more refreshing.

android {
    //...
    sourceSets {
        main {
            res.srcDirs += "src/main/res-i18n"
        }
    }
}

Notice

Be careful to choose the source language correctly, otherwise the translation may not be accurate

1.For Android strings.xml please add translatable="false" for strings not to be translated:

<string name="test" translatable="false">Test</string>

2.For .properties file,please store untranslated strings and translated strings in separate files

Sponsor

https://github.com/wilinz/Sponsor

Develop

Run command in terminal: ./gradlew runIde

Screenshot