1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Added translation guide / Added locale list autogen

This commit is contained in:
Anuken 2018-07-21 00:44:13 -04:00
parent ec4eac3a7d
commit 52cc7d699a
4 changed files with 41 additions and 3 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@
/android/assets/mindustry-saves/
/core/assets/gifexport/
/core/assets/version.properties
/core/assets/locales.json
*.gif
version.properties

23
TRANSLATING.md Normal file
View File

@ -0,0 +1,23 @@
## Translating for Mindustry
To begin, log in to your GitHub account, or if you don't have one yet, create it [here](https://github.com/).
Consult [this list](https://www.science.co.il/language/Locale-codes.php) to find the locale code for your language. Once you've found it,
head over to the Mindustry GitHub repository and check the [list of bundles](https://github.com/Anuken/Mindustry/tree/master/core/assets/bundles) that have already been created.
You're looking for a file called "`bundle_`(insert locale code here)`.properties`".
#### Editing an existing translation
If a translation bundle already exists, that means someone has already started working on a translation. To edit it or translate text, simply click the file and press the edit (pencil) button in the top right. Once you're done editing, press the green "propose file change" button at the bottom, then "create pull request" (twice).
Once this is done, all you need to do is wait for me to approve your changes.
#### Creating a new translation bundle
If a translation bundle for your language *doesn't* exist, you need to create one yourself.
In the folder with all the bundles in it, click the *'create new file'* button, and name it `bundle_(locale code here).properties`.
Then, copy-paste the entire contents of the [English translation bundle](https://raw.githubusercontent.com/Anuken/Mindustry/master/core/assets/bundles/bundle.propertie) into the file, and edit it to your liking.
Once you are done, press the *propose new file* button at the bottom, then 'create pull request twice'.
**And that's it.**
*(...of course, that's never really it. Bother me on Discord when something inevatably goes wrong.)*

View File

@ -43,6 +43,17 @@ allprojects {
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
}
generateLocales = {
def output = '["en",'
def bundles = new File('core/assets/bundles/')
bundles.listFiles().each { other ->
if(other.name == "bundle.properties") return;
output += '"' + other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + '",'
}
output = (output.substring(0, output.size() - 1) + "]")
new File('core/assets/locales.json').text = output;
}
writeVersion = {
def pfile = new File('core/assets/version.properties')
def props = new Properties()
@ -135,8 +146,13 @@ project(":ios") {
project(":core") {
apply plugin: "java"
task finish {
generateLocales()
}
dependencies {
compileOnly project(":annotations")
build.finalizedBy(finish)
boolean comp = System.properties["release"] == null || System.properties["release"] == "false"

View File

@ -1,3 +1 @@
[
"en", "fr", "ru", "uk_UA", "pl", "de", "pt_BR","ko","in_ID", "ita","es","zh_TW"
]
["en","es","pl","ita","ko","fr","ru","de","in_ID","tk","pt_BR","zh_TW","uk_UA"]