Skip to content

Commit

Permalink
refactor: Translation (#9)
Browse files Browse the repository at this point in the history
* refactor: add all human-readable strings to parkour_english.txt

* feat: use translations from i18n files

* feat: add french translation

* fix: display world scoreboard on HUD tilt animation end

* fix: french typos

* refactor: translate parkour start indicator text
  • Loading branch information
Alystrasz authored Aug 28, 2023
1 parent 9b368c8 commit 75d30a2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
Binary file modified mod/resource/parkour_english.txt
Binary file not shown.
Binary file added mod/resource/parkour_french.txt
Binary file not shown.
8 changes: 4 additions & 4 deletions mod/scripts/vscripts/gamemodes/cl_gamemode_pk.nut
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ void function ServerCallback_ToggleStartIndicatorDisplay( bool show )
// Only display warning message once every two minutes
int now = GetUnixTimestamp()
if ( show && now - file.startIndicatorTime > 120) {
string template = "\x1b[93m%s:\x1b[0m Getting lost, %s?\nI added coordinates of the parkour start to your HUD."
string message = format(template, ROBOT_NAME, GetLocalClientPlayer().GetPlayerName())
Chat_GameWriteLine(message)
string prefix = format("\x1b[93m%s:\x1b[0m ", ROBOT_NAME)
string message = Localize("#ROBOT_LOST_PLAYER", GetLocalClientPlayer().GetPlayerName())
Chat_GameWriteLine(prefix + message)
file.startIndicatorTime = GetUnixTimestamp()
EmitSoundOnEntity( player, "diag_spectre_gs_LeechStart_01_1" )
} else {
Expand Down Expand Up @@ -359,6 +359,6 @@ void function ServerCallback_CreateStartIndicator( int indicatorEntityHandle )
file.startIndicatorRUI = CreateCockpitRui( $"ui/overhead_icon_evac.rpak" )
RuiSetBool( file.startIndicatorRUI, "isVisible", false )
RuiSetImage( file.startIndicatorRUI, "icon", $"rui/hud/titanfall_marker_arrow_ready" )
RuiSetString( file.startIndicatorRUI, "statusText", "Parkour start" )
RuiSetString( file.startIndicatorRUI, "statusText", "#PARKOUR_START" )
RuiTrackFloat3( file.startIndicatorRUI, "pos", indicator, RUI_TRACK_ABSORIGIN_FOLLOW )
}
30 changes: 15 additions & 15 deletions mod/scripts/vscripts/ui/robot_dialog.nut
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ void function Parkour_OpenRobotDialog( string mapName )

DialogData dialogData
dialogData.image = $"rui/faction/faction_logo_mrvn"
dialogData.header = "Parkour information"
dialogData.header = Localize( "#ROBOT_DIALOG1_TITLE" )

dialogData.message = "Hello pilot, and welcome to the Parkour mode!\n\n\n"
+ "The goal is simple: go through the start line, and get to the finish line as fast as you can while crossing all checkpoints in order!\n\n"
+ "If you are fast enough, you might see your name appear on the local or (even better) world scoreboard!!\n\n\n"
+ "Wanna know more?"
dialogData.message = Localize( "#ROBOT_DIALOG1_TEXT1" ) + "\n\n\n"
+ Localize( "#ROBOT_DIALOG1_TEXT2" ) + "\n\n"
+ Localize( "#ROBOT_DIALOG1_TEXT3" ) + "\n\n\n"
+ Localize( "#ROBOT_DIALOG1_TEXT4" )

AddDialogButton( dialogData, "Tell me more!", ParkourShowMoreDetails )
AddDialogButton( dialogData, "Nope, thank you!", ParkourExitDialog )
AddDialogButton( dialogData, "#ROBOT_DIALOG1_BTN1", ParkourShowMoreDetails )
AddDialogButton( dialogData, "#ROBOT_DIALOG1_BTN2", ParkourExitDialog )
dialogData.forceChoice = true

OpenDialog( dialogData )
Expand All @@ -30,17 +30,17 @@ void function ParkourShowMoreDetails()

DialogData dialogData
dialogData.image = $"rui/faction/faction_logo_mrvn"
dialogData.header = "More about Parkour"
dialogData.header = Localize( "#ROBOT_DIALOG2_TITLE" )

dialogData.message = "Don't try to switch weapons, all pilots have a predefined set of weapons and abilities, so that everyone is on an equal footing.\n\n"
+ "If your run is not going well, you can press %offhand4% to reappear here, and restart a new one!\n\n"
+ "And if your time does not appear on the leaderboards, don't worry!\n"
+ "I register scores of all pilots on this map; even scores not appearing here are saved, so pilots can compare to other pilots."
dialogData.message = Localize( "#ROBOT_DIALOG2_TEXT1" ) + "\n\n"
+ Localize( "#ROBOT_DIALOG2_TEXT2" ) + "\n\n"
+ Localize( "#ROBOT_DIALOG2_TEXT3" ) + "\n"
+ Localize( "#ROBOT_DIALOG2_TEXT4" )

AddDialogButton(dialogData, "Show me the world scoreboard!", void function() {
AddDialogButton(dialogData, "#ROBOT_DIALOG2_BTN1", void function() {
thread ParkourOpenWebScoreboard()
})
AddDialogButton( dialogData, "Thanks!", ParkourExitDialog )
AddDialogButton( dialogData, "#ROBOT_DIALOG2_BTN2", ParkourExitDialog )
dialogData.forceChoice = true

OpenDialog( dialogData )
Expand All @@ -59,7 +59,7 @@ void function ParkourOpenWebScoreboard()
{
ParkourExitDialog()

wait 0.2
wait 0.8
string endpoint = GetConVarString("parkour_api_endpoint") + "?map=" + file.mapName
LaunchExternalWebBrowser(endpoint, WEBBROWSER_FLAG_FORCEEXTERNAL)
}
3 changes: 1 addition & 2 deletions mod/scripts/vscripts/utils/npc.nut
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ void function SpawnAmbientMarvin( vector origin, vector angles, int talkableRadi
npc_marvin.SetUsable()
npc_marvin.SetUsableRadius( talkableRadius )
npc_marvin.AddUsableValue( USABLE_BY_PILOTS | USABLE_HINT_ONLY )
string prompt = "Press %use% to talk to " + ROBOT_NAME
npc_marvin.SetUsePrompts( prompt, prompt )
npc_marvin.SetUsePrompts( "#ROBOT_INTERACTION_PROMPT", "#ROBOT_INTERACTION_PROMPT" )
}

0 comments on commit 75d30a2

Please sign in to comment.