Made translation documentation + more

Made UpdateScreen translatable
Small fixes
This commit is contained in:
Ne_Eo
2024-10-04 22:21:02 +02:00
parent 8e2ffbb920
commit a69d6ce35f
7 changed files with 70 additions and 14 deletions
+20
View File
@@ -0,0 +1,20 @@
# Translations
## Adding a new language
1. Create a new folder in this folder with the language's code. Using the ISO 3166-1 codes for the language. (ex: `en` for English, `es` for Spanish, etc) (For full list of codes, see [here](https://en.wikipedia.org/wiki/ISO_3166-1#Codes))
2. Create a `config.ini` file in the folder with the following contents:
```ini
name="Your Language Name in translated language"
credits="Your Name (your github username)"
version="version based on the English config.ini version"
```
3. Copy the xml files from the `en` (English) folder and paste them in the new folder.
4. Translate the texts in the copied xml files. The {0} and {1}, and so on are placeholders are used for variables, and should be left as is.
5. Make a pull request with your changes.
Make sure the pull request is labeled as `[LANG] Add <language name>` or `[LANG] Update <language name>` or `[LANG] Fix typo in <language name>`, generally anything is allowed but it has to contain the language name.
+3
View File
@@ -34,6 +34,7 @@
<str id="scrollSpeed">Scroll Speed</str>
<str id="strumLineList">Strumlines $* Atleast 1 Strumline Required$</str>
<str id="strumLine.format">Strumline - #{0}</str>
</group>
<group name="ChartDataScreen" prefix="chartDataScreen.">
@@ -56,6 +57,8 @@
<str id="title-editing">Edit Event Group</str>
<str id="noEvent">No Event</str>
<str id="strumLine.format">Strumline #{0} ({1})</str>
</group>
<group name="CharterEventTypeSelection" prefix="charterEventTypeSelection.">
+21
View File
@@ -75,6 +75,27 @@
<str id="betaWarning.desc">This engine is still in a *{0}* state. That means *majority of the features* are either *buggy* or *non finished*. If you find any bugs, please report them to the Codename Engine GitHub.\n\nPress {1} to continue</str>
</group>
<group name="Updater">
<group name="UpdateAvailable">
<str id="updateAvailable.title">NEW UPDATE</str>
<str id="updateAvailable.install">INSTALL</str>
<str id="updateAvailable.skip">SKIP</str>
</group>
<group name="UpdateScreen">
<str id="updateScreen.general-1">Preparing update installation...</str>
<str id="updateScreen.part-1">Creating installation folder and cleaning old update files...</str>
<str id="updateScreen.general-2">Downloading update assets...</str>
<str id="updateScreen.part-2">Downloading file {0}</str>
<str id="updateScreen.general-3">Downloading new engine executable...</str>
<str id="updateScreen.part-3">Downloading {0}</str>
<str id="updateScreen.general-4">Installing new files...</str>
<str id="updateScreen.part-4">Installing {0}</str>
</group>
</group>
<group name="Difficulties">
<str id="diff.easy">Easy</str>
<str id="diff.normal">Normal</str>
@@ -129,7 +129,6 @@ typedef EventInfoFile = {
typedef EventInfo = {
var params:Array<EventParamInfo>;
var paramValues:Array<Dynamic>;
}
typedef EventParamInfo = {
@@ -82,20 +82,20 @@ class UpdateScreen extends MusicBeatState {
switch(prog.step) {
case PREPARING:
progressBar.value = 0;
generalProgress.text = "Preparing update installation... (1/4)";
partProgress.text = "Creating installation folder and cleaning old update files...";
generalProgress.text = TU.translate("updateScreen.general-1") + " (1/4)";
partProgress.text = TU.translate("updateScreen.part-1");
case DOWNLOADING_ASSETS:
progressBar.value = 1 + ((prog.curFile-1+(prog.bytesLoaded/prog.bytesTotal)) / prog.files);
generalProgress.text = "Downloading update assets... (2/4)";
partProgress.text = 'Downloading file ${prog.curFileName}\n(${prog.curFile+1}/${prog.files} | ${CoolUtil.getSizeString(prog.bytesLoaded)} / ${CoolUtil.getSizeString(prog.bytesTotal)} | ${CoolUtil.getSizeString(lerpSpeed)}/s)';
generalProgress.text = TU.translate("updateScreen.general-2") + " (2/4)";
partProgress.text = TU.translate("updateScreen.part-2", [prog.curFileName]) + '\n(${prog.curFile+1}/${prog.files} | ${CoolUtil.getSizeString(prog.bytesLoaded)} / ${CoolUtil.getSizeString(prog.bytesTotal)} | ${CoolUtil.getSizeString(lerpSpeed)}/s)';
case DOWNLOADING_EXECUTABLE:
progressBar.value = 2 + (prog.bytesLoaded/prog.bytesTotal);
generalProgress.text = "Downloading new engine executable... (3/4)";
partProgress.text = 'Downloading ${prog.curFileName}\n(${CoolUtil.getSizeString(prog.bytesLoaded)} / ${CoolUtil.getSizeString(prog.bytesTotal)} | ${CoolUtil.getSizeString(lerpSpeed)}/s)';
generalProgress.text = TU.translate("updateScreen.general-3") + " (3/4)";
partProgress.text = TU.translate("updateScreen.part-3", [prog.curFileName]) + '\n(${CoolUtil.getSizeString(prog.bytesLoaded)} / ${CoolUtil.getSizeString(prog.bytesTotal)} | ${CoolUtil.getSizeString(lerpSpeed)}/s)';
case INSTALLING:
progressBar.value = 3 + ((prog.curFile-1+(prog.curZipProgress.curFile/prog.curZipProgress.fileCount))/prog.files);
generalProgress.text = "Installing new files... (4/4)";
partProgress.text = 'Installing ${prog.curFileName}\n(${prog.curFile}/${prog.files})';
generalProgress.text = TU.translate("updateScreen.general-4") + " (4/4)";
partProgress.text = TU.translate("updateScreen.part-4", [prog.curFileName]) + '\n(${prog.curFile}/${prog.files})';
}
var rect = new FlxRect(0, (1 - (progressBar.value / 4)) * bf.frameHeight, bf.frameWidth, 0);
rect.height = bf.frameHeight - rect.y;
@@ -117,7 +117,8 @@ class ChartCreationScreen extends UISubstateWindow {
TU.translate("chartCreation.strumLineList"),
[new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]);
strumLineList.dragCallback = (object:StrumLineButton, oldIndex:Int, newIndex:Int) -> {object.idText.text = 'Strumline - #${newIndex}';};
var strumlineFormat = TU.getRaw("chartCreation.strumLine.format");
strumLineList.dragCallback = (object:StrumLineButton, oldIndex:Int, newIndex:Int) -> {object.idText.text = strumlineFormat.format([newIndex]);};
scrollSpeedTextBox.onChange(scrollSpeedTextBox.label.text);
saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() {
@@ -217,7 +218,7 @@ class StrumLineButton extends UIButton {
charactersList.add(new CompactCharacterButton(character, subState.charFileList, charactersList));
members.push(charactersList);
idText = addLabelOn(charactersList, 'Strumline - #$id');
idText = addLabelOn(charactersList, TU.translate("chartCreation.strumLine.format", [id]));
cameraClipShader = new CustomShader("engine/cameraClip");
cameraClipShader.hset("clipRect", [0, 0, 100, 100]);
@@ -119,12 +119,20 @@ class CharterEventScreen extends UISubstateWindow {
if (id >= 0 && id < events.length) {
curEvent = id;
var curEvent = events[curEvent];
eventName.text = curEvent.name;
var visualName = curEvent.name;
var tuId = "charter.events." + TU.raw2Id(curEvent.name);
if(TU.exists(tuId))
visualName = TU.translate(tuId);
eventName.text = visualName;
// add new elements
var y:Float = eventName.y + eventName.height + 10;
for(k=>param in EventsData.getEventParams(curEvent.name)) {
function addLabel() {
var label:UIText = new UIText(eventName.x, y, 0, param.name);
var visualName = param.name;
// TODO: add translations
var label:UIText = new UIText(eventName.x, y, 0, visualName);
y += label.height + 4;
paramsPanel.add(label);
};
@@ -152,7 +160,11 @@ class CharterEventScreen extends UISubstateWindow {
numericStepper;
case TStrumLine:
addLabel();
var dropdown = new UIDropDown(eventName.x, y, 320, 32, [for(k=>s in cast(FlxG.state, Charter).strumLines.members) 'Strumline #${k+1} (${s.strumLine.characters[0]})'], cast value);
var strumlineFormat = TU.getRaw("charterEventScreen.strumLine.format");
var dropdown = new UIDropDown(eventName.x, y, 320, 32, [
for(k=>s in cast(FlxG.state, Charter).strumLines.members)
strumlineFormat.format([k+1, s.strumLine.characters[0]])
], cast value);
paramsPanel.add(dropdown); paramsFields.push(dropdown);
dropdown;
case TColorWheel: