diff --git a/assets/languages/en/Editors.xml b/assets/languages/en/Editors.xml index a681d615..0ff90c6f 100644 --- a/assets/languages/en/Editors.xml +++ b/assets/languages/en/Editors.xml @@ -2,14 +2,248 @@ Autosaving in {0} seconds{1} + (Canceled)! + + Save & Close + Save + Close + Ok - - Chart Editor + + Select a song to modify the charts from." + Press ACCEPT to choose a difficulty to edit. + Press ACCEPT to edit the chart for the selected difficulty. + Select a difficulty to continue. + New Difficulty + New Song - Add Event - Edit - Delete Event + + Creating Song: Error! + The song you are trying to create already exists, if you would like to override it delete the song first! + Creating Chart: Error! + The chart you are trying to create already exists, if you would like to override it delete the chart first! + + + + + Creating New Chart + Chart Info + Difficulty Name + Stage + Scroll Speed + + Strumlines $* Atleast 1 Strumline Required$ + + + + Chart Properties + Edit Chart Data + Stage + Scroll Speed + + + + Create Event Group + Edit Event Group + + No Event + + + + Choose an event type... + + + + Edit Metadata + + Song Data + Song Name + BPM + Time Signature + Menus Data (Freeplay/Story) + Display Name + Icon + Modes Allowed + Color + Difficulties + Custom Values (Advanced) + + Opponent Mode + Co-op Mode + + + + Note Types List Editor + + Edit Note Types + Note Type {0} + + + + Creating strumline {0} + Editing strumline {0} properties + + Create New Strumline + Edit Strumline Properties + + + + Creating New Song + Song Info + + Inst Audio File $* Required*$ + Vocal Audio File $* Required*$ + + Back + Next + + + + Characters + New Char + Type + Scroll Speed + Stage Position + Scale + Hud Position (X [Ratio 0-1],Y) + Visible? + Uses charts scroll speed? + Vocal Suffix + + + + Chart Editor + + + + File + + New + Save + Save As... + Save Without Events + Save Without Events As... + Save Events Separately + Save Events Separately As... + Save Meta + Save Meta As... + Export For FNF Legacy... + Export For Psych Engine... + Exit + + + Edit + + Undo + Redo + Copy + Paste + Cut + Delete + + + Chart + + Playtest + Playtest here + Playtest as opponent + Playtest as opponent here + Enable scripts during playtesting + Edit chart data + Edit metadata information + + + View + + Zoom in + Zoom out + Reset Zoom + Show Sections Separator + Show Beats Separator + Low Detail Waveforms + + + Song + + Go back to the start + Go forward to the end + Mute instrumental + Mute voices + + + Note + + Add sustain length + Subtract sustain length + Select all + Select measure + Edit Note Types List + + Snap + + ↑ Grid Snap + Reset Grid Snap + ↓ Grid Snap + + {0}x Grid Snap + + + Playback + + Play/Pause + ↑ Speed {0}% + Reset Speed + ↓ Speed {0}% + Go back a section + Go forward a section + Metronome + Visual metronome + + + + + Default Note + + + + + + + + HScript Call + Camera Movement + Add Camera Zoom + Camera Modulo Change + Camera Flash + BPM Change + Scroll Speed Change + Alt Animation Toggle + Play Animation + + + + Options ↓ + + Hitsounds + Mute Vocals + Edit + Delete + + No Waveform + + + Create New + Lock/Unlock + + + Add Event + Edit + Delete Event + + + Saved chart at {0}! + diff --git a/source/funkin/backend/utils/TranslationUtil.hx b/source/funkin/backend/utils/TranslationUtil.hx index b8ba5080..649b4bc1 100644 --- a/source/funkin/backend/utils/TranslationUtil.hx +++ b/source/funkin/backend/utils/TranslationUtil.hx @@ -111,7 +111,7 @@ final class TranslationUtil * If `id` is `null` then it's gonna search using `defString`. */ public static inline function get(?id:String, ?params:Array, ?def:String):String - return getUnformatted(id, def).format(params); + return getRaw(id, def).format(params); public static inline function translate(?id:String, ?params:Array, ?def:String):String return get(id, params, def); @@ -126,7 +126,7 @@ final class TranslationUtil return false; #end - public static function getUnformatted(id:String, ?def:String):IFormatInfo + public static function getRaw(id:String, ?def:String):IFormatInfo { #if TRANSLATIONS_SUPPORT if (stringMap.exists(id)) return stringMap.get(id); @@ -154,7 +154,7 @@ final class TranslationUtil public static function raw2Id(str:String):String { var result:String = ""; - for(i => s in str.split(" ")) result += (i == 0 ? s.charAt(0).toLowerCase() : s.charAt(0).toUpperCase()) + s.substr(1); + for(i => s in str.split(" ")) result += (i == 0 ? s.charAt(0).toLowerCase() : s.charAt(0).toUpperCase()) + s.substr(1).toLowerCase(); return result.length == 0 ? str : result; } @@ -260,6 +260,7 @@ final class TranslationUtil if(node.getAtt("notrim").getDefault("true") != "true") value = value.trim(); value = value.replace("\\n", "\n").replace("\r", ""); // remove stupid windows line breaks and convert newline literals to newlines leMap.set(id, FormatUtil.get(value)); + //leMap.set(id, FormatUtil.getStr("{" + id + "}")); //Logs.trace("Added " + id + " -> `" + value + "`", "Language"); } diff --git a/source/funkin/editors/charter/ChartCreationScreen.hx b/source/funkin/editors/charter/ChartCreationScreen.hx index 78983762..259d028d 100644 --- a/source/funkin/editors/charter/ChartCreationScreen.hx +++ b/source/funkin/editors/charter/ChartCreationScreen.hx @@ -26,7 +26,7 @@ class ChartCreationScreen extends UISubstateWindow { } public override function create() { - winTitle = "Creating New Chart"; + winTitle = TU.translate("chartCreation.title"); winWidth = 652; winHeight = 600; @@ -43,11 +43,11 @@ class ChartCreationScreen extends UISubstateWindow { if (charFileList.length == 0) charFileList = Character.getList(false); var chartTitle:UIText; - add(chartTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Chart Info", 28)); + add(chartTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, TU.translate("chartCreation.info"), 28)); difficultyNameTextBox = new UITextBox(chartTitle.x, chartTitle.y + chartTitle.height + 36, "difficulty", 200); add(difficultyNameTextBox); - addLabelOn(difficultyNameTextBox, "Difficulty Name"); + addLabelOn(difficultyNameTextBox, TU.translate("chartCreation.diffName")); var stageFileList = Stage.getList(true); if (stageFileList.length == 0) stageFileList = Stage.getList(false); @@ -55,7 +55,7 @@ class ChartCreationScreen extends UISubstateWindow { stageTextBox = new UIAutoCompleteTextBox(difficultyNameTextBox.x + 200 + 26, difficultyNameTextBox.y, "stage", 180); stageTextBox.suggestItems = stageFileList; add(stageTextBox); - addLabelOn(stageTextBox, "Stage"); + addLabelOn(stageTextBox, TU.translate("chartCreation.stage")); scrollSpeedTextBox = new UINumericStepper(stageTextBox.x + 180 + 26, difficultyNameTextBox.y, 1.0, 0.1, 2, null, null, 90); scrollSpeedTextBox.onChange = function (text:String) { @@ -65,7 +65,7 @@ class ChartCreationScreen extends UISubstateWindow { button.scrollSpeedStepper.value = scrollSpeedTextBox.value; } add(scrollSpeedTextBox); - addLabelOn(scrollSpeedTextBox, "Scroll Speed"); + addLabelOn(scrollSpeedTextBox, TU.translate("chartCreation.scrollSpeed")); strumLineList = new UIButtonList(difficultyNameTextBox.x, difficultyNameTextBox.y+difficultyNameTextBox.bHeight+36, 620, (552-179)-16, "", FlxPoint.get(620, 246), null, 6); strumLineList.frames = Paths.getFrames('editors/ui/inputbox'); @@ -113,20 +113,20 @@ class ChartCreationScreen extends UISubstateWindow { }, strumLineList)); add(strumLineList); - addLabelOn(strumLineList, "Strumlines").applyMarkup( - "Strumlines $* Atleast 1 Strumline Required$", + addLabelOn(strumLineList, "").applyMarkup( + TU.translate("chartCreation.strumLineList"), [new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]); strumLineList.dragCallback = (object:StrumLineButton, oldIndex:Int, newIndex:Int) -> {object.idText.text = 'Strumline - #${newIndex}';}; scrollSpeedTextBox.onChange(scrollSpeedTextBox.label.text); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() { createChart(); close(); }, 125); add(saveButton); - closeButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, "Cancel", function() { + closeButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, TU.translate("editor.close"), function() { close(); }, 125); add(closeButton); @@ -212,7 +212,7 @@ class StrumLineButton extends UIButton { charactersList.cameraSpacing = 0; charactersList.addButton.callback = function() - charactersList.add(new CompactCharacterButton("New Char", subState.charFileList, charactersList)); + charactersList.add(new CompactCharacterButton(TU.translate("charterStrumLine.newChar"), subState.charFileList, charactersList)); for (character in strumLine.characters) charactersList.add(new CompactCharacterButton(character, subState.charFileList, charactersList)); @@ -225,17 +225,17 @@ class StrumLineButton extends UIButton { typeDropdown = new UIDropDown(charactersList.x + charactersList.bWidth + 16, 8+26, 200, 32, ["OPPONENT", "PLAYER", "ADDITIONAL"], strumLine.type); members.push(typeDropdown); - addLabelOn(typeDropdown, "Type"); + addLabelOn(typeDropdown, TU.translate("charterStrumLine.type")); var stagePositionI = strumLine.position == null ? strumLine.type : ["DAD", "BOYFRIEND", "GIRLFRIEND"].indexOf(strumLine.position.toUpperCase()); stagePositionDropdown = new UIDropDown(typeDropdown.x + 200 - 32 + 26, typeDropdown.y, 200, 32, ["DAD", "BOYFRIEND", "GIRLFRIEND"], stagePositionI); members.push(stagePositionDropdown); - addLabelOn(stagePositionDropdown, "Stage Position"); + addLabelOn(stagePositionDropdown, TU.translate("charterStrumLine.stagePos")); hudScaleStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 64, strumLine.strumScale == null ? 1 : strumLine.strumScale, 0.001, 2, null, null, 74); members.push(hudScaleStepper); - addLabelOn(hudScaleStepper, "Scale"); + addLabelOn(hudScaleStepper, TU.translate("charterStrumLine.scale")); var strOffset:Float = strumLine.strumLinePos == null ? (strumLine.type == 1 ? 0.75 : 0.25) : strumLine.strumLinePos; @@ -245,22 +245,22 @@ class StrumLineButton extends UIButton { hudXStepper = new UINumericStepper(hudScaleStepper.x + 80 - 32 + 26, hudScaleStepper.y, startingPos.x, 0.01, 2, 0, 2, 84); members.push(hudXStepper); - addLabelOn(hudXStepper, "Hud Position (X [Ratio 0-1],Y)"); + addLabelOn(hudXStepper, TU.translate("charterStrumLine.hudPos")); members.push(XYComma = new UIText(hudXStepper.x + 84 - 32 + 0, hudXStepper.y + 9, 0, ",", 22)); hudYStepper = new UINumericStepper(hudXStepper.x + 84 - 32 + 26, hudXStepper.y, startingPos.y, 0.001, 2, null, null, 84); members.push(hudYStepper); - visibleCheckbox = new UICheckbox(hudYStepper.x + hudYStepper.bWidth + 42, hudYStepper.y + 9, "Visible?", strumLine.visible == null ? true : strumLine.visible); + visibleCheckbox = new UICheckbox(hudYStepper.x + hudYStepper.bWidth + 42, hudYStepper.y + 9, TU.translate("charterStrumLine.visible"), strumLine.visible == null ? true : strumLine.visible); members.push(visibleCheckbox); scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 128, strumLine.scrollSpeed, 0.1, 2, 0, 10, 82); scrollSpeedStepper.selectable = strumLine.scrollSpeed != null; members.push(scrollSpeedStepper); - addLabelOn(scrollSpeedStepper, "Scroll Speed"); + addLabelOn(scrollSpeedStepper, TU.translate("charterStrumLine.scrollSpeed")); - usesChartscrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); + usesChartscrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, TU.translate("charterStrumLine.useChartScrollSpeed"), strumLine.scrollSpeed == null); usesChartscrollSpeed.onChecked = function(b) { if(b) { scrollSpeedStepper.value = subState.scrollSpeedTextBox.value; diff --git a/source/funkin/editors/charter/ChartDataScreen.hx b/source/funkin/editors/charter/ChartDataScreen.hx index bc0762ad..981b1bf8 100644 --- a/source/funkin/editors/charter/ChartDataScreen.hx +++ b/source/funkin/editors/charter/ChartDataScreen.hx @@ -24,7 +24,7 @@ class ChartDataScreen extends UISubstateWindow { FlxG.sound.music.pause(); Charter.instance.vocals.pause(); - winTitle = 'Chart Properties'; + winTitle = TU.translate("chartDataScreen.title"); winWidth = 420; winHeight = 230; // guys look, the funny numbers! super.create(); @@ -33,7 +33,7 @@ class ChartDataScreen extends UISubstateWindow { add(new UIText(ui.x, ui.y - 24, 0, text)); var title:UIText; - add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Edit Chart Data", 28)); + add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, TU.translate("chartDataScreen.editChartData"), 28)); var stageFileList = Stage.getList(true); if (stageFileList.length == 0) stageFileList = Stage.getList(false); @@ -41,19 +41,19 @@ class ChartDataScreen extends UISubstateWindow { stageTextBox = new UIAutoCompleteTextBox(title.x, title.y + title.height + 38, PlayState.SONG.stage, 200); stageTextBox.suggestItems = stageFileList; add(stageTextBox); - addLabelOn(stageTextBox, "Stage"); + addLabelOn(stageTextBox, TU.translate("chartDataScreen.stage")); scrollSpeedStepper = new UINumericStepper(stageTextBox.x + 200 + 26, stageTextBox.y, data.scrollSpeed, 0.1, 2, 0, 10, 82); add(scrollSpeedStepper); - addLabelOn(scrollSpeedStepper, "Scroll Speed"); + addLabelOn(scrollSpeedStepper, TU.translate("chartDataScreen.scrollSpeed")); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() { saveInfo(); close(); }, 125); add(saveButton); - closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Close", function() { + closeButton = new UIButton(saveButton.x - 20, saveButton.y, TU.translate("editor.close"), function() { close(); }, 125); add(closeButton); diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 72ff1155..e11ce49a 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -100,152 +100,152 @@ class Charter extends UIState { public override function create() { super.create(); - WindowUtils.suffix = " (Chart Editor)"; + WindowUtils.suffix = " (" + TU.translate("charter.name") + ")"; SaveWarning.selectionClass = CharterSelection; SaveWarning.saveFunc = () -> {_file_save(null);}; topMenu = [ { - label: "File", + label: TU.translate("charter.topBar.file"), childs: [ { - label: "New" + label: TU.translate("charter.file.new") }, null, { - label: "Save", + label: TU.translate("charter.file.save"), keybind: [CONTROL, S], onSelect: _file_save, }, { - label: "Save As...", + label: TU.translate("charter.file.saveAs"), keybind: [CONTROL, SHIFT, S], onSelect: _file_saveas, }, null, { - label: "Save Without Events", + label: TU.translate("charter.file.saveWithoutEvents"), keybind: [CONTROL, ALT, TAB, S], onSelect: _file_save_no_events, }, { - label: "Save Without Events As...", + label: TU.translate("charter.file.saveWithoutEventsAs"), keybind: [CONTROL, SHIFT, ALT, TAB, S], onSelect: _file_saveas_no_events, }, { - label: "Save Events Separately", + label: TU.translate("charter.file.saveEventsSeparately"), keybind: [CONTROL, TAB, S], onSelect: _file_events_save, }, { - label: "Save Events Separately As...", + label: TU.translate("charter.file.saveEventsSeparatelyAs"), keybind: [CONTROL, SHIFT, TAB, S], onSelect: _file_events_saveas, }, null, { - label: "Save Meta", + label: TU.translate("charter.file.saveMeta"), keybind: [CONTROL, ALT, S], onSelect: _file_meta_save, }, { - label: "Save Meta As...", + label: TU.translate("charter.file.saveMetaAs"), keybind: [CONTROL, ALT ,SHIFT, S], onSelect: _file_meta_saveas, }, null, { - label: "Export For FNF Legacy...", + label: TU.translate("charter.file.exportFnfLegacy"), onSelect: _file_saveas_fnflegacy, }, { - label: "Export For Psych Engine...", + label: TU.translate("charter.file.exportPsych"), onSelect: _file_saveas_psych, }, null, { - label: "Exit", + label: TU.translate("charter.file.exit"), onSelect: _file_exit } ] }, { - label: "Edit", + label: TU.translate("charter.topBar.edit"), childs: [ { - label: "Undo", + label: TU.translate("charter.edit.undo"), keybind: [CONTROL, Z], onSelect: _edit_undo }, { - label: "Redo", + label: TU.translate("charter.edit.redo"), keybinds: [[CONTROL, Y], [CONTROL, SHIFT, Z]], onSelect: _edit_redo }, null, { - label: "Copy", + label: TU.translate("charter.edit.copy"), keybind: [CONTROL, C], onSelect: _edit_copy }, { - label: "Paste", + label: TU.translate("charter.edit.paste"), keybind: [CONTROL, V], onSelect: _edit_paste }, null, { - label: "Cut", + label: TU.translate("charter.edit.cut"), keybind: [CONTROL, X], onSelect: _edit_cut }, { - label: "Delete", + label: TU.translate("charter.edit.delete"), keybind: [DELETE], onSelect: _edit_delete } ] }, { - label: "Chart", + label: TU.translate("charter.topBar.chart"), childs: [ { - label: "Playtest", + label: TU.translate("charter.chart.playtest"), keybind: [ENTER], onSelect: _chart_playtest }, { - label: "Playtest here", + label: TU.translate("charter.chart.playtestHere"), keybind: [SHIFT, ENTER], onSelect: _chart_playtest_here }, null, { - label: "Playtest as opponent", + label: TU.translate("charter.chart.playtestOpponent"), keybind: [CONTROL, ENTER], onSelect: _chart_playtest_opponent }, { - label: "Playtest as opponent here", + label: TU.translate("charter.chart.playtestOpponentHere"), keybind: [CONTROL, SHIFT, ENTER], onSelect: _chart_playtest_opponent_here }, null, { - label: 'Enable scripts during playtesting', + label: TU.translate("charter.chart.enableScripts"), onSelect: _chart_enablescripts, icon: Options.charterEnablePlaytestScripts ? 1 : 0 }, null, { - label: "Edit chart data", + label: TU.translate("charter.chart.editChartData"), color: 0xFF959829, icon: 4, onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, onSelect: chart_edit_data }, { - label: "Edit metadata information", + label: TU.translate("charter.chart.editMetadata"), color: 0xFF959829, icon: 4, onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, onSelect: chart_edit_metadata @@ -253,114 +253,114 @@ class Charter extends UIState { ] }, { - label: "View", + label: TU.translate("charter.topBar.view"), childs: [ { - label: "Zoom in", + label: TU.translate("charter.view.zoomIn"), keybind: [CONTROL, NUMPADPLUS], onSelect: _view_zoomin }, { - label: "Zoom out", + label: TU.translate("charter.view.zoomOut"), keybind: [CONTROL, NUMPADMINUS], onSelect: _view_zoomout }, { - label: "Reset zoom", + label: TU.translate("charter.view.resetZoom"), keybind: [CONTROL, NUMPADZERO], onSelect: _view_zoomreset }, null, { - label: 'Show Sections Separator', + label: TU.translate("charter.view.showSectionsSeparator"), onSelect: _view_showeventSecSeparator, icon: Options.charterShowSections ? 1 : 0 }, { - label: 'Show Beats Separator', + label: TU.translate("charter.view.showBeatsSeparator"), onSelect: _view_showeventBeatSeparator, icon: Options.charterShowBeats ? 1 : 0 }, null, { - label: 'Low Detail Waveforms', + label: TU.translate("charter.view.lowDetailWaveforms"), onSelect: _view_switchWaveformDetail, icon: Options.charterLowDetailWaveforms ? 1 : 0 } ] }, { - label: "Song", + label: TU.translate("charter.topBar.song"), childs: [ { - label: "Go back to the start", + label: TU.translate("charter.song.goStart"), keybind: [HOME], onSelect: _song_start }, { - label: "Go to the end", + label: TU.translate("charter.song.goEnd"), keybind: [END], onSelect: _song_end }, null, { - label: "Mute instrumental", + label: TU.translate("charter.song.muteInst"), onSelect: _song_muteinst }, { - label: "Mute voices", + label: TU.translate("charter.song.muteVoices"), onSelect: _song_mutevoices } ] }, { - label: "Note >", + label: TU.translate("charter.topBar.note") + " >", childs: buildNoteTypesUI() }, { - label: "Snap >", + label: TU.translate("charter.topBar.snap") + " >", childs: buildSnapsUI() }, { - label: "Playback >", + label: TU.translate("charter.topBar.playback") + " >", childs: [ { - label: "Play/Pause", + label: TU.translate("charter.playback.play"), keybind: [SPACE], onSelect: _playback_play }, null, { - label: "↑ Speed 25%", + label: TU.translate("charter.playback.speedRaise", ["25"]), onSelect: _playback_speed_raise }, { - label: "Reset Speed", + label: TU.translate("charter.playback.speedReset"), onSelect: _playback_speed_reset }, { - label: "↓ Speed 25%", + label: TU.translate("charter.playback.speedLower", ["25"]), onSelect: _playback_speed_lower }, null, { - label: "Go back a section", + label: TU.translate("charter.playback.sectionBack"), keybind: [A], onSelect: _playback_back }, { - label: "Go forward a section", + label: TU.translate("charter.playback.sectionForward"), keybind: [D], onSelect: _playback_forward }, null, { - label: "Metronome", + label: TU.translate("charter.playback.metronome"), onSelect: _playback_metronome, icon: Options.charterMetronomeEnabled ? 1 : 0 }, { - label: "Visual metronome" + label: TU.translate("charter.playback.visualMetronome") }, ] } @@ -406,7 +406,7 @@ class Charter extends UIState { topMenuSpr = new UITopMenu(topMenu); topMenuSpr.cameras = uiGroup.cameras = [uiCamera]; - noteTypeText = new UIText(0, 0, 0, "(0) Default Note"); + noteTypeText = new UIText(0, 0, 0, "(0) " + TU.translate("charter.noteTypes.default")); noteTypeText.cameras = [uiCamera]; scrollBar = new UIScrollBar(FlxG.width - 20, topMenuSpr.bHeight, 1000, 0, 100); @@ -444,12 +444,12 @@ class Charter extends UIState { autoSaveNotif = new CharterAutoSaveUI(20, strumlineInfoBG.y + strumlineInfoBG.height + 20); uiGroup.add(autoSaveNotif); - strumlineAddButton = new CharterStrumlineButton("editors/new", "Create New"); + strumlineAddButton = new CharterStrumlineButton("editors/new", TU.translate("charter.createNew")); strumlineAddButton.onClick = createStrumWithUI; strumlineAddButton.animationOnClick = false; strumlineAddButton.textColorLerp = 0.5; - strumlineLockButton = new CharterStrumlineButton("editors/charter/lock-strumline", "Lock/Unlock"); + strumlineLockButton = new CharterStrumlineButton("editors/charter/lock-strumline", TU.translate("charter.lock-unlock")); strumlineLockButton.onClick = function () { if (strumLines != null) { strumLines.draggable = !strumLines.draggable; @@ -697,9 +697,9 @@ class Charter extends UIState { if (autoSaveTimer < Options.charterAutoSaveWarningTime && !autoSaveNotif.cancelled && !autoSaveNotif.showedAnimation) { if (Options.charterAutoSavesSeperateFolder) __autoSaveLocation = __diff.toLowerCase() + DateTools.format(Date.now(), "%m-%d_%H-%M"); + var filename = !Options.charterAutoSavesSeperateFolder ? '${__diff.toLowerCase()}.json' : '${__autoSaveLocation}.json'; autoSaveNotif.startAutoSave(autoSaveTimer, - !Options.charterAutoSavesSeperateFolder ? 'Saved chart at ${__diff.toLowerCase()}.json!' : - 'Saved chart at $__autoSaveLocation.json!' + TU.translate("charter.popup.savedChartAt", [filename]) ); } if (autoSaveTimer <= 0) { @@ -1182,7 +1182,7 @@ class Charter extends UIState { noteTypeText.x = noteTopButton.x + noteTopButton.bWidth + 6; noteTypeText.y = Std.int((noteTopButton.bHeight - noteTypeText.height) / 2); } - noteTypeText.text = '($noteType) ${noteTypes[noteType-1] == null ? "Default Note" : noteTypes[noteType-1]}'; + noteTypeText.text = '($noteType) ${noteTypes[noteType-1] == null ? TU.translate("noteTypes.default") : noteTypes[noteType-1]}'; super.update(elapsed); @@ -1220,6 +1220,7 @@ class Charter extends UIState { for (strumLine in strumLines.members) strumLine.vocals.pause(); } + // TODO: make this translatable? songPosInfo.text = '${CoolUtil.timeToStr(Conductor.songPosition)} / ${CoolUtil.timeToStr(songLength)}' + '\nStep: ${curStep}' + '\nBeat: ${curBeat}' @@ -1614,25 +1615,27 @@ class Charter extends UIState { var snapsTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[snapIndex]; var newChilds:Array = [ { - label: "↑ Grid Snap", + label: TU.translate("charter.snap.increaseSnap"), keybind: [X], onSelect: _snap_increasesnap }, { - label: "Reset Grid Snap", + label: TU.translate("charter.snap.resetSnap"), onSelect: _snap_resetsnap }, { - label: "↓ Grid Snap", + label: TU.translate("charter.snap.decreaseSnap"), keybind: [Z], onSelect: _snap_decreasesnap }, null ]; + var snapStr = TU.getRaw("charter.snap.snap"); + for (_quant in quants) newChilds.push({ - label: '${_quant}x Grid Snap', + label: snapStr.format([_quant]), onSelect: (_) -> {setquant(_quant); buildSnapsUI();}, icon: _quant == quant ? 1 : 0 }); @@ -1700,29 +1703,29 @@ class Charter extends UIState { var noteTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[noteIndex]; var newChilds:Array = [ { - label: "Add sustain length", + label: TU.translate("charter.note.addSustainLength"), keybind: [E], onSelect: _note_addsustain }, { - label: "Subtract sustain length", + label: TU.translate("charter.note.subtractSustainLength"), keybind: [Q], onSelect: _note_subtractsustain }, null, { - label: "Select all", + label: TU.translate("charter.note.selectAll"), keybind: [CONTROL, A], onSelect: _note_selectall }, { - label: "Select measure", + label: TU.translate("charter.note.selectMeasure"), keybind: [CONTROL, SHIFT, A], onSelect: _note_selectmeasure }, null, { - label: "(0) Default Note", + label: "(0) " + TU.translate("charter.noteTypes.default"), keybind: [ZERO], onSelect: (_) -> {changeNoteType(0);}, icon: this.noteType == 0 ? 1 : 0 @@ -1733,6 +1736,7 @@ class Charter extends UIState { for (i=>type in noteTypes) { var realNoteID:Int = i+1; // Default Note not stored var newChild:UIContextMenuOption = { + // TODO: make this translatable? label: '(${realNoteID}) ${type}', onSelect: (_) -> {changeNoteType(realNoteID);}, icon: this.noteType == realNoteID ? 1 : 0 @@ -1741,7 +1745,7 @@ class Charter extends UIState { newChilds.push(newChild); } newChilds.push({ - label: "Edit Note Types List", + label: TU.translate("charter.note.editNoteTypesList"), color: 0xFF959829, icon: 4, onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, onSelect: editNoteTypesList diff --git a/source/funkin/editors/charter/CharterAutoSaveUI.hx b/source/funkin/editors/charter/CharterAutoSaveUI.hx index 73684c0f..4f2ab8ae 100644 --- a/source/funkin/editors/charter/CharterAutoSaveUI.hx +++ b/source/funkin/editors/charter/CharterAutoSaveUI.hx @@ -45,7 +45,8 @@ class CharterAutoSaveUI extends UISliceSprite { icon.animation.curAnim.curFrame = 2; (new FlxTimer()).start(1, (_) -> {disappearAnimation(true);}); - autosavingText.text += " (Canceled)!"; cancelButton.visible = false; + autosavingText.text += " " + TU.translate("editor.autosavingCanceledSuffix"); + cancelButton.visible = false; for (member in [this, autosavingText]) member.color = 0xFFE67F7F; for (member in [progressBar, progressBarBack]) member.color = 0xFFE67F7F; }, 24, 14); diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index 20d84715..75272376 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -36,7 +36,7 @@ class CharterEventScreen extends UISubstateWindow { var creatingEvent:Bool = chartEvent == null; if (creatingEvent) chartEvent = new CharterEvent(step, []); - winTitle = creatingEvent ? "Create Event Group" : "Edit Event Group"; + winTitle = TU.translate("charterEventScreen.title" + (creatingEvent ? "-creating" : "-editing")); winWidth = 960; super.create(); @@ -64,7 +64,7 @@ class CharterEventScreen extends UISubstateWindow { paramsPanel = new FlxGroup(); add(paramsPanel); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() { saveCurTab(); chartEvent.refreshEventIcons(); @@ -92,7 +92,7 @@ class CharterEventScreen extends UISubstateWindow { saveButton.x -= saveButton.bWidth; add(saveButton); - closeButton = new UIButton(saveButton.x - 10, saveButton.y, "Close", ()->close()); + closeButton = new UIButton(saveButton.x - 10, saveButton.y, TU.translate("editor.close"), ()->close()); closeButton.color = 0xFFFF0000; closeButton.x -= closeButton.bWidth; add(closeButton); @@ -189,7 +189,7 @@ class CharterEventScreen extends UISubstateWindow { y += cast(lastAdded, FlxSprite).height + 6; } } else { - eventName.text = "No event"; + eventName.text = TU.translate("charterEventScreen.noEvent"); // Maybe should be No Events? curEvent = -1; } } diff --git a/source/funkin/editors/charter/CharterEventTypeSelection.hx b/source/funkin/editors/charter/CharterEventTypeSelection.hx index bfa6cfe7..4888442a 100644 --- a/source/funkin/editors/charter/CharterEventTypeSelection.hx +++ b/source/funkin/editors/charter/CharterEventTypeSelection.hx @@ -19,7 +19,7 @@ class CharterEventTypeSelection extends UISubstateWindow { } public override function create() { - winTitle = "Choose an event type..."; + winTitle = TU.translate("charterEventTypeSelection.title"); super.create(); var w:Int = winWidth - 20; @@ -33,7 +33,11 @@ class CharterEventTypeSelection extends UISubstateWindow { add(buttonsBG); for(k=>eventName in EventsData.eventsList) { - var button = new UIButton(0, (32 * k), eventName, function() { + var visualName = eventName; + var tuId = "charter.events." + TU.raw2Id(eventName); + if(TU.exists(tuId)) + visualName = TU.translate(tuId); + var button = new UIButton(0, (32 * k), visualName, function() { close(); callback(eventName); }, w); @@ -56,7 +60,7 @@ class CharterEventTypeSelection extends UISubstateWindow { windowSpr.bHeight = 61 + (32 * (17)); - add(new UIButton(10, windowSpr.bHeight-42, "Cancel", function() { + add(new UIButton(10, windowSpr.bHeight-42, TU.translate("editor.cancel"), function() { close(); }, w)); diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index 660e3d89..ab3c0638 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -30,8 +30,11 @@ class CharterMetaDataScreen extends UISubstateWindow { this.metadata = metadata; } + inline function translate(id:String):String + return TU.translate("charterMetaDataScreen." + id); + public override function create() { - winTitle = "Edit Metadata"; + winTitle = translate("title"); winWidth = 1056; winHeight = 520; @@ -44,52 +47,52 @@ class CharterMetaDataScreen extends UISubstateWindow { add(new UIText(ui.x, ui.y - 24, 0, text)); var title:UIText; - add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Song Data", 28)); + add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, translate("songData"), 28)); songNameTextBox = new UITextBox(title.x, title.y + title.height + 36, metadata.name); add(songNameTextBox); - addLabelOn(songNameTextBox, "Song Name"); + addLabelOn(songNameTextBox, translate("songName")); bpmStepper = new UINumericStepper(songNameTextBox.x + 320 + 26, songNameTextBox.y, metadata.bpm, 1, 2, 1, null, 90); add(bpmStepper); - addLabelOn(bpmStepper, "BPM"); + addLabelOn(bpmStepper, translate("bpm")); beatsPerMeasureStepper = new UINumericStepper(bpmStepper.x + 60 + 26, bpmStepper.y, metadata.beatsPerMeasure, 1, 0, 1, null, 54); add(beatsPerMeasureStepper); - addLabelOn(beatsPerMeasureStepper, "Time Signature"); + addLabelOn(beatsPerMeasureStepper, translate("timeSignature")); add(new UIText(beatsPerMeasureStepper.x + 30, beatsPerMeasureStepper.y + 3, 0, "/", 22)); stepsPerBeatStepper = new UINumericStepper(beatsPerMeasureStepper.x + 30 + 24, beatsPerMeasureStepper.y, metadata.stepsPerBeat, 1, 0, 1, null, 54); add(stepsPerBeatStepper); - add(title = new UIText(songNameTextBox.x, songNameTextBox.y + 10 + 46, 0, "Menus Data (Freeplay/Story)", 28)); + add(title = new UIText(songNameTextBox.x, songNameTextBox.y + 10 + 46, 0, translate("menusData"), 28)); displayNameTextBox = new UITextBox(title.x, title.y + title.height + 36, metadata.displayName); add(displayNameTextBox); - addLabelOn(displayNameTextBox, "Display Name"); + addLabelOn(displayNameTextBox, translate("displayName")); iconTextBox = new UITextBox(displayNameTextBox.x + 320 + 26, displayNameTextBox.y, metadata.icon, 150); iconTextBox.onChange = (newIcon:String) -> {updateIcon(newIcon);} add(iconTextBox); - addLabelOn(iconTextBox, "Icon"); + addLabelOn(iconTextBox, translate("icon")); updateIcon(metadata.icon); - opponentModeCheckbox = new UICheckbox(displayNameTextBox.x, iconTextBox.y + 10 + 32 + 26, "Opponent Mode", metadata.opponentModeAllowed); + opponentModeCheckbox = new UICheckbox(displayNameTextBox.x, iconTextBox.y + 10 + 32 + 26, translate("opponentMode"), metadata.opponentModeAllowed); add(opponentModeCheckbox); - addLabelOn(opponentModeCheckbox, "Modes Allowed"); + addLabelOn(opponentModeCheckbox, translate("modesAllowed")); - coopAllowedCheckbox = new UICheckbox(opponentModeCheckbox.x + 150 + 26, opponentModeCheckbox.y, "Co-op Mode", metadata.coopAllowed); + coopAllowedCheckbox = new UICheckbox(opponentModeCheckbox.x + 150 + 26, opponentModeCheckbox.y, translate("coopAllowed"), metadata.coopAllowed); add(coopAllowedCheckbox); colorWheel = new UIColorwheel(iconTextBox.x, coopAllowedCheckbox.y, metadata.parsedColor); add(colorWheel); - addLabelOn(colorWheel, "Color"); + addLabelOn(colorWheel, translate("color")); difficulitesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, metadata.difficulties.join(", ")); add(difficulitesTextBox); - addLabelOn(difficulitesTextBox, "Difficulties"); + addLabelOn(difficulitesTextBox, translate("difficulties")); customPropertiesButtonList = new UIButtonList(stepsPerBeatStepper.x + 80 + 26 + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5); customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox'); @@ -100,19 +103,19 @@ class CharterMetaDataScreen extends UISubstateWindow { for (val in Reflect.fields(metadata.customValues)) customPropertiesButtonList.add(new PropertyButton(val, Reflect.field(metadata.customValues, val), customPropertiesButtonList)); add(customPropertiesButtonList); - addLabelOn(customPropertiesButtonList, "Custom Values (Advanced)"); + addLabelOn(customPropertiesButtonList, translate("customValues")); for (checkbox in [opponentModeCheckbox, coopAllowedCheckbox]) {checkbox.y += 6; checkbox.x += 4;} - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight - 20, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20, windowSpr.y + windowSpr.bHeight - 20, TU.translate("editor.saveClose"), function() { saveMeta(); close(); }, 125); saveButton.x -= saveButton.bWidth; saveButton.y -= saveButton.bHeight; - closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Close", function() { + closeButton = new UIButton(saveButton.x - 20, saveButton.y, TU.translate("editor.close"), function() { close(); }, 125); closeButton.color = 0xFFFF0000; diff --git a/source/funkin/editors/charter/CharterNoteTypesList.hx b/source/funkin/editors/charter/CharterNoteTypesList.hx index 50f23a2e..2c10c49e 100644 --- a/source/funkin/editors/charter/CharterNoteTypesList.hx +++ b/source/funkin/editors/charter/CharterNoteTypesList.hx @@ -14,32 +14,37 @@ class CharterNoteTypesList extends UISubstateWindow { FlxG.sound.music.pause(); Charter.instance.vocals.pause(); - winTitle = 'Note Types List Editor'; + winTitle = TU.translate("charterNoteTypesList.title"); winWidth = 380; winHeight = 390; super.create(); var title:UIText; - add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Edit Note Types", 28)); + add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, TU.translate("charterNoteTypesList.editNoteTypes"), 28)); var noteTypesFileList = getNoteTypesList(true); if (noteTypesFileList.length == 0) noteTypesFileList = getNoteTypesList(false); noteTypesList = new UIButtonList(20, title.y + title.height + 10, winWidth - 40, 342 - 85 - 16, "", FlxPoint.get(winWidth - 40, (342 - 85 - 16)/4), null, 0); - noteTypesList.addButton.callback = () -> noteTypesList.add(new NoteTypeButton(0, 0, 'Note Type ${noteTypesList.buttons.members.length}', noteTypesList.buttons.members.length, noteTypesFileList, noteTypesList)); + noteTypesList.addButton.callback = () -> { + noteTypesList.add(new NoteTypeButton(0, 0, + TU.translate("charterNoteTypesList.editType", [noteTypesList.buttons.members.length]), + noteTypesList.buttons.members.length, noteTypesFileList, noteTypesList)); + } noteTypesList.cameraSpacing = 0; noteTypesList.dragCallback = (object:NoteTypeButton, oldIndex:Int, newIndex:Int) -> {object.IDText.text = '${newIndex}.';}; for (i=>noteType in Charter.instance.noteTypes) + // TODO: make this translatable noteTypesList.add(new NoteTypeButton(0, 0, noteType, i, noteTypesFileList, noteTypesList)); add(noteTypesList); noteTypesList.frames = Paths.getFrames('editors/ui/inputbox'); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() { saveList(); close(); }, 125); add(saveButton); - closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Close", function() { + closeButton = new UIButton(saveButton.x - 20, saveButton.y, TU.translate("editor.close"), function() { close(); }, 125); add(closeButton); diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index 24fe55f4..e7cde686 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -26,26 +26,28 @@ class CharterSelection extends EditorTreeMenu { freeplayList = FreeplaySonglist.get(false); var list:Array = [ - for(s in freeplayList.songs) new EditorIconOption(s.name, "Press ACCEPT to choose a difficulty to edit.", s.icon, function() { + for(s in freeplayList.songs) new EditorIconOption(s.name, TU.translate("charterSelection.accept-song"), s.icon, function() { curSong = s; var list:Array = [ for(d in s.difficulties) if (d != "") - new TextOption(d, "Press ACCEPT to edit the chart for the selected difficulty", function() { + new TextOption(d, TU.translate("charterSelection.accept-difficulty"), function() { FlxG.switchState(new Charter(s.name, d)); }) ]; - list.push(new NewOption("New Difficulty", "New Difficulty", function() { + var newDiff = TU.translate("charterSelection.newDifficulty"); + list.push(new NewOption(newDiff, newDiff, function() { FlxG.state.openSubState(new ChartCreationScreen(saveChart)); })); - optionsTree.add(new OptionsScreen(s.name, "Select a difficulty to continue.", list)); + optionsTree.add(new OptionsScreen(s.name, TU.translate("charterSelection.selectDifficulty"), list)); }, s.parsedColor.getDefault(0xFFFFFFFF)) ]; - list.insert(0, new NewOption("New Song", "New Song", function() { + var newSong = TU.translate("charterSelection.newSong"); + list.insert(0, new NewOption(newSong, newSong, function() { FlxG.state.openSubState(new SongCreationScreen(saveSong)); })); - main = new OptionsScreen("Chart Editor", "Select a song to modify the charts from.", list); + main = new OptionsScreen(TU.translate("charter.name"), TU.translate("charterSelection.desc"), list); DiscordUtil.call("onEditorTreeLoaded", ["Chart Editor"]); } @@ -92,8 +94,8 @@ class CharterSelection extends EditorTreeMenu { var songAlreadlyExsits:Bool = [for (s in freeplayList.songs) s.name.toLowerCase()].contains(creation.meta.name.toLowerCase()); if (songAlreadlyExsits) { - openSubState(new UIWarningSubstate("Creating Song: Error!", "The song you are trying to create alreadly exists, if you would like to override it delete the song first!", [ - {label: "Ok", color: 0xFFFF0000, onClick: function(t) {}} + openSubState(new UIWarningSubstate(TU.translate("chartCreation.warnings.song-exists-title"), TU.translate("chartCreation.warnings.song-exists-body"), [ + {label: TU.translate("editor.ok"), color: 0xFFFF0000, onClick: function(t) {}}, ])); return; } @@ -114,18 +116,20 @@ class CharterSelection extends EditorTreeMenu { if (creation.voicesBytes != null) sys.io.File.saveBytes('$songFolder/song/Voices.${Paths.SOUND_EXT}', creation.voicesBytes); #end - var option = new EditorIconOption(creation.meta.name, "Press ACCEPT to choose a difficulty to edit.", creation.meta.icon, function() { + // duplicated code, todo: fix this + var option = new EditorIconOption(creation.meta.name, TU.translate("charterSelection.accept-song"), creation.meta.icon, function() { curSong = creation.meta; var list:Array = [ for(d in creation.meta.difficulties) - if (d != "") new TextOption(d, "Press ACCEPT to edit the chart for the selected difficulty", function() { + if (d != "") new TextOption(d, TU.translate("charterSelection.accept-difficulty"), function() { FlxG.switchState(new Charter(creation.meta.name, d)); }) ]; - list.push(new NewOption("New Difficulty", "New Difficulty", function() { + var newDiff = TU.translate("charterSelection.newDifficulty"); + list.push(new NewOption(newDiff, newDiff, function() { FlxG.state.openSubState(new ChartCreationScreen(saveChart)); })); - optionsTree.insert(1, new OptionsScreen(creation.meta.name, "Select a difficulty to continue.", list)); + optionsTree.insert(1, new OptionsScreen(creation.meta.name, TU.translate("charterSelection.selectDifficulty"), list)); }, creation.meta.parsedColor.getDefault(0xFFFFFFFF)); // Add to List @@ -137,8 +141,8 @@ class CharterSelection extends EditorTreeMenu { var difficultyAlreadlyExsits:Bool = curSong.difficulties.contains(name); if (difficultyAlreadlyExsits) { - openSubState(new UIWarningSubstate("Creating Chart: Error!", "The chart you are trying to create alreadly exists, if you would like to override it delete the chart first!", [ - {label: "Ok", color: 0xFFFF0000, onClick: function(t) {}} + openSubState(new UIWarningSubstate(TU.translate("chartCreation.warnings.chart-exists-title"), TU.translate("chartCreation.warnings.chart-exists-body"), [ + {label: TU.translate("editor.ok"), color: 0xFFFF0000, onClick: function(t) {}}, ])); return; } @@ -150,8 +154,9 @@ class CharterSelection extends EditorTreeMenu { CoolUtil.safeSaveFile('$songFolder/charts/${name}.json', Json.stringify(data, "\t")); // Add to List + // duplicated code, todo: fix this curSong.difficulties.push(name); - var option = new TextOption(name, "Press ACCEPT to edit the chart for the selected difficulty", function() { + var option = new TextOption(name, TU.translate("charterSelection.accept-difficulty"), function() { FlxG.switchState(new Charter(curSong.name, name)); }); optionsTree.members[optionsTree.members.length-1].insert(optionsTree.members[optionsTree.members.length-1].length-1, option); diff --git a/source/funkin/editors/charter/CharterStrumline.hx b/source/funkin/editors/charter/CharterStrumline.hx index 1f94f711..bce0ca2e 100644 --- a/source/funkin/editors/charter/CharterStrumline.hx +++ b/source/funkin/editors/charter/CharterStrumline.hx @@ -123,7 +123,8 @@ class CharterStrumline extends UISprite { class CharterStrumlineOptions extends UITopMenuButton { var strLine:CharterStrumline; public function new(parent:CharterStrumline) { - super(0, 95, null, "Options ↓", []); + // TODO: better id for this + super(0, 95, null, TU.translate("charter.strumLine.button-name"), []); strLine = parent; bWidth = 40 * 4; this.label.fieldWidth = bWidth; @@ -137,14 +138,14 @@ class CharterStrumlineOptions extends UITopMenuButton { public override function openContextMenu() { contextMenu = [ { - label: "Hitsounds", + label: TU.translate("charter.strumLine.hitsounds"), onSelect: function(_) { strLine.hitsounds = !strLine.hitsounds; }, icon: strLine.hitsounds ? 1 : 0 }, { - label: "Mute Vocals", + label: TU.translate("charter.strumLine.muteVocals"), onSelect: function(_) { strLine.vocals.volume = strLine.vocals.volume > 0 ? 0 : 1; }, @@ -152,7 +153,7 @@ class CharterStrumlineOptions extends UITopMenuButton { }, null, { - label: "Edit", + label: TU.translate("charter.strumLine.edit"), onSelect: function (_) { Charter.instance.editStrumline(strLine.strumLine); }, @@ -160,7 +161,7 @@ class CharterStrumlineOptions extends UITopMenuButton { icon: 4 }, { - label: "Delete", + label: TU.translate("charter.strumLine.delete"), onSelect: function (_) { Charter.instance.deleteStrumlineFromData(strLine.strumLine); }, @@ -170,7 +171,7 @@ class CharterStrumlineOptions extends UITopMenuButton { ]; contextMenu.insert(0, { - label: "No Waveform", + label: TU.translate("charter.strumLine.noWaveform"), onSelect: function(_) {strLine.selectedWaveform = -1;}, icon: strLine.selectedWaveform == -1 ? 1 : 0 }); diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 997a294f..86305682 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -46,7 +46,7 @@ class CharterStrumlineScreen extends UISubstateWindow { visible: true }; - winTitle = creatingStrumLine ? 'Creating strumline #$strumLineID' : 'Editing strumline #$strumLineID properties'; + winTitle = TU.translate("charterStrumlineScreen.win-title" + (creatingStrumLine ? "-creating" : "-editing"), ["#" + strumLineID]); winWidth = 690; winHeight = 400; FlxG.sound.music.pause(); @@ -58,26 +58,26 @@ class CharterStrumlineScreen extends UISubstateWindow { add(new UIText(ui.x, ui.y - 24, 0, text)); var title:UIText; - add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, creatingStrumLine ? "Create New Strumline" : "Edit Strumline Properties", 28)); + add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, TU.translate("charterStrumlineScreen.title" + (creatingStrumLine ? "-creating" : "-editing")), 28)); var charFileList = Character.getList(true); if (charFileList.length == 0) charFileList = Character.getList(false); charactersList = new UIButtonList(15, title.y + title.height + 36, 250, 269, "", FlxPoint.get(250, 54), null, 0); - charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, "New Char", charFileList, charactersList)); + charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, TU.translate("charterStrumLine.newChar"), charFileList, charactersList)); charactersList.cameraSpacing = 0; for (i in strumLine.characters) charactersList.add(new CharacterButton(0, 0, i, charFileList, charactersList)); add(charactersList); - addLabelOn(charactersList, "Characters"); + addLabelOn(charactersList, TU.translate("charterStrumLine.characters")); charactersList.frames = Paths.getFrames('editors/ui/inputbox'); typeDropdown = new UIDropDown(charactersList.x + charactersList.bWidth + 16, charactersList.y, 200, 32, ["OPPONENT", "PLAYER", "ADDITIONAL"], strumLine.type); add(typeDropdown); - addLabelOn(typeDropdown, "Type"); + addLabelOn(typeDropdown, TU.translate("charterStrumLine.type")); - usesChartscrollSpeed = new UICheckbox(typeDropdown.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); + usesChartscrollSpeed = new UICheckbox(typeDropdown.x + 104, typeDropdown.y + 135, TU.translate("charterStrumLine.useChartScrollSpeed"), strumLine.scrollSpeed == null); usesChartscrollSpeed.onChecked = function(b) { if(b) { @@ -97,17 +97,17 @@ class CharterStrumlineScreen extends UISubstateWindow { scrollSpeedStepper.selectable = true; } add(scrollSpeedStepper); - addLabelOn(scrollSpeedStepper, "Scroll Speed"); + addLabelOn(scrollSpeedStepper, TU.translate("charterStrumLine.scrollSpeed")); var stagePositionI = strumLine.position == null ? strumLine.type : ["DAD", "BOYFRIEND", "GIRLFRIEND"].indexOf(strumLine.position.toUpperCase()); stagePositionDropdown = new UIDropDown(typeDropdown.x + 200 - 32 + 26, typeDropdown.y, 200, 32, ["DAD", "BOYFRIEND", "GIRLFRIEND"], stagePositionI); add(stagePositionDropdown); - addLabelOn(stagePositionDropdown, "Stage Position"); + addLabelOn(stagePositionDropdown, TU.translate("charterStrumLine.stagePos")); hudScaleStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 64, strumLine.strumScale == null ? 1 : strumLine.strumScale, 0.001, 2, null, null, 74); add(hudScaleStepper); - addLabelOn(hudScaleStepper, "Scale"); + addLabelOn(hudScaleStepper, TU.translate("charterStrumLine.scale")); var strOffset:Float = strumLine.strumLinePos == null ? (strumLine.type == 1 ? 0.75 : 0.25) : strumLine.strumLinePos; @@ -117,23 +117,23 @@ class CharterStrumlineScreen extends UISubstateWindow { hudXStepper = new UINumericStepper(hudScaleStepper.x + 80 - 32 + 26, hudScaleStepper.y, startingPos.x, 0.01, 2, 0, 2, 84); add(hudXStepper); - addLabelOn(hudXStepper, "Hud Position (X [Ratio 0-1],Y)"); + addLabelOn(hudXStepper, TU.translate("charterStrumLine.hudPos")); add(new UIText(hudXStepper.x + 84 - 32 + 0, hudXStepper.y + 9, 0, ",", 22)); hudYStepper = new UINumericStepper(hudXStepper.x + 84 - 32 + 26, hudXStepper.y, startingPos.y, 0.001, 2, null, null, 84); add(hudYStepper); - visibleCheckbox = new UICheckbox(hudYStepper.x + hudYStepper.bWidth + 42, hudYStepper.y + 9, "Visible?", strumLine.visible); + visibleCheckbox = new UICheckbox(hudYStepper.x + hudYStepper.bWidth + 42, hudYStepper.y + 9, TU.translate("charterStrumLine.visible"), strumLine.visible); add(visibleCheckbox); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() { saveStrumline(); close(); }, 125); add(saveButton); - closeButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, creatingStrumLine ? "Cancel" : "Close", function() { + closeButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, TU.translate("editor." + (creatingStrumLine ? "cancel" : "close")), function() { if (creatingStrumLine && onSave != null) onSave(null); close(); }, 125); @@ -155,7 +155,7 @@ class CharterStrumlineScreen extends UISubstateWindow { vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixlist, strumLine.vocalsSuffix != null && strumLine.vocalsSuffix != "" ? suffixlist.indexOf(strumLine.vocalsSuffix) : 0); add(vocalsSuffixDropDown); - addLabelOn(vocalsSuffixDropDown, "Vocal Suffix"); + addLabelOn(vocalsSuffixDropDown, TU.translate("charterStrumLine.vocalSuffix")); } function saveStrumline() { diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index 7915cae0..b1d7e5a1 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -46,8 +46,14 @@ class SongCreationScreen extends UISubstateWindow { if (onSave != null) this.onSave = onSave; } + inline function translate(id:String):String + return TU.translate("songCreationScreen." + id); + + inline function translateMeta(id:String):String + return TU.translate("charterMetaDataScreen." + id); + public override function create() { - winTitle = "Creating New Song"; + winTitle = translate("win-title"); winWidth = 748 - 32 + 40; winHeight = 520; @@ -61,19 +67,19 @@ class SongCreationScreen extends UISubstateWindow { } var songTitle:UIText; - songDataGroup.add(songTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Song Info", 28)); + songDataGroup.add(songTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, translate("title"), 28)); - songNameTextBox = new UITextBox(songTitle.x, songTitle.y + songTitle.height + 36, "Song Name"); + songNameTextBox = new UITextBox(songTitle.x, songTitle.y + songTitle.height + 36, translateMeta("songName")); songDataGroup.add(songNameTextBox); - addLabelOn(songNameTextBox, "Song Name"); + addLabelOn(songNameTextBox, translateMeta("songName")); bpmStepper = new UINumericStepper(songNameTextBox.x + 320 + 26, songNameTextBox.y, 100, 1, 2, 1, null, 90); songDataGroup.add(bpmStepper); - addLabelOn(bpmStepper, "BPM"); + addLabelOn(bpmStepper, translateMeta("bpm")); beatsPerMeasureStepper = new UINumericStepper(bpmStepper.x + 60 + 26, bpmStepper.y, 4, 1, 0, 1, null, 54); songDataGroup.add(beatsPerMeasureStepper); - addLabelOn(beatsPerMeasureStepper, "Time Signature"); + addLabelOn(beatsPerMeasureStepper, translateMeta("timeSignature")); songDataGroup.add(new UIText(beatsPerMeasureStepper.x + 30, beatsPerMeasureStepper.y + 3, 0, "/", 22)); @@ -88,8 +94,8 @@ class SongCreationScreen extends UISubstateWindow { instExplorer.uiElement = audioPlayer; }); songDataGroup.add(instExplorer); - addLabelOn(instExplorer, "Inst Audio File").applyMarkup( - "Inst Audio File $* Required$", + addLabelOn(instExplorer, "").applyMarkup( + translate("instAudio"), [new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]); voicesExplorer = new UIFileExplorer(instExplorer.x + 320 + 26, instExplorer.y, null, null, Paths.SOUND_EXT, function (res) { @@ -99,44 +105,44 @@ class SongCreationScreen extends UISubstateWindow { }); songDataGroup.add(voicesExplorer); - voicesUIText = addLabelOn(voicesExplorer, "Vocal Audio File"); + voicesUIText = addLabelOn(voicesExplorer, ""); voicesUIText.applyMarkup( - "Vocal Audio File $* Required$", + translate("voicesAudio"), [new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]); var menuTitle:UIText; - menuDataGroup.add(menuTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Menus Data (Freeplay/Story)", 28)); + menuDataGroup.add(menuTitle = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, translateMeta("menusData"), 28)); - displayNameTextBox = new UITextBox(menuTitle.x, menuTitle.y + menuTitle.height + 36, "Display Name"); + displayNameTextBox = new UITextBox(menuTitle.x, menuTitle.y + menuTitle.height + 36, translateMeta("displayName")); menuDataGroup.add(displayNameTextBox); - addLabelOn(displayNameTextBox, "Display Name"); + addLabelOn(displayNameTextBox, translateMeta("displayName")); - iconTextBox = new UITextBox(displayNameTextBox.x + 320 + 26, displayNameTextBox.y, "Icon", 150); + iconTextBox = new UITextBox(displayNameTextBox.x + 320 + 26, displayNameTextBox.y, "face", 150); iconTextBox.onChange = (newIcon:String) -> {updateIcon(newIcon);} menuDataGroup.add(iconTextBox); - addLabelOn(iconTextBox, "Icon"); + addLabelOn(iconTextBox, translateMeta("icon")); - updateIcon("Icon"); + updateIcon("face"); - opponentModeCheckbox = new UICheckbox(displayNameTextBox.x, iconTextBox.y + 10 + 32 + 26, "Opponent Mode", true); + opponentModeCheckbox = new UICheckbox(displayNameTextBox.x, iconTextBox.y + 10 + 32 + 26, translateMeta("opponentMode"), true); menuDataGroup.add(opponentModeCheckbox); - addLabelOn(opponentModeCheckbox, "Modes Allowed"); + addLabelOn(opponentModeCheckbox, translateMeta("modesAllowed")); - coopAllowedCheckbox = new UICheckbox(opponentModeCheckbox.x + 150 + 26, opponentModeCheckbox.y, "Co-op Mode", true); + coopAllowedCheckbox = new UICheckbox(opponentModeCheckbox.x + 150 + 26, opponentModeCheckbox.y, translateMeta("coopAllowed"), true); menuDataGroup.add(coopAllowedCheckbox); colorWheel = new UIColorwheel(iconTextBox.x, coopAllowedCheckbox.y, 0xFFFFFF); menuDataGroup.add(colorWheel); - addLabelOn(colorWheel, "Color"); + addLabelOn(colorWheel, translateMeta("color")); difficulitesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, ""); menuDataGroup.add(difficulitesTextBox); - addLabelOn(difficulitesTextBox, "Difficulties"); + addLabelOn(difficulitesTextBox, translateMeta("difficulties")); for (checkbox in [opponentModeCheckbox, coopAllowedCheckbox]) {checkbox.y += 6; checkbox.x += 4;} - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() { + saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, TU.translate("editor.saveClose"), function() { if (curPage == pages.length-1) { saveSongInfo(); close(); @@ -149,7 +155,7 @@ class SongCreationScreen extends UISubstateWindow { }, 125); add(saveButton); - backButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, "< Back", function() { + backButton = new UIButton(saveButton.x - 20 - saveButton.bWidth, saveButton.y, "< " + translate("back"), function() { curPage--; refreshPages(); @@ -157,7 +163,7 @@ class SongCreationScreen extends UISubstateWindow { }, 125); add(backButton); - closeButton = new UIButton(backButton.x - 20 - saveButton.bWidth, saveButton.y, "Cancel", function() { + closeButton = new UIButton(backButton.x - 20 - saveButton.bWidth, saveButton.y, TU.translate("editor.close"), function() { close(); }, 125); add(closeButton); @@ -197,10 +203,10 @@ class SongCreationScreen extends UISubstateWindow { titleSpr.x = windowSpr.x + 25; titleSpr.y = windowSpr.y + ((30 - titleSpr.height) / 2); - saveButton.field.text = curPage == pages.length-1 ? "Save & Close" : 'Next >'; - titleSpr.text = 'Creating New Song (${curPage+1}/${pages.length})'; + saveButton.field.text = curPage == pages.length-1 ? TU.translate("editor.saveClose") : translate("next") + " >"; + titleSpr.text = translate("win-title") + ' (${curPage+1}/${pages.length})'; - backButton.field.text = '< Back'; + backButton.field.text = '< ' + translate("back"); backButton.visible = backButton.exists = curPage > 0; backButton.x = (saveButton.x = windowSpr.x + windowSpr.bWidth - 20 - 125) - 20 - saveButton.bWidth;