Skip to content

Commit 43869d2

Browse files
committed
Store language files as UTF-8
1 parent f79a4fd commit 43869d2

25 files changed

+757
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ set( THREADS_PREFER_PTHREAD_FLAG ON )
348348
find_package( Threads REQUIRED )
349349
find_package( nlohmann_json CONFIG REQUIRED )
350350
find_package( unofficial-pcre CONFIG REQUIRED )
351+
find_package( Python 3.8...<4.0 COMPONENTS Interpreter )
351352

352353
include( cmake/lib/SDL2.cmake )
353354

gamedir/CMakeLists.txt

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
set( TXT_UNICODE_CONVERT_REGEX "\\.utf8\\.txt$" )
2+
set( TXT_UNICODE_CONVERT_REPLACE ".txt" )
3+
14
set( CLIENT_FILES
25
resource/GameMenu.res
36

@@ -30,17 +33,17 @@ set( CLIENT_FILES
3033
ui/resource/SpectatorInfoPanel.res
3134
ui/resource/TeamMenu.res
3235

33-
ui/resource/language/bugfixedhl_english.txt
34-
ui/resource/language/bugfixedhl_russian.txt
35-
ui/resource/language/chat_english.txt
36-
ui/resource/language/chat_french.txt
37-
ui/resource/language/chat_german.txt
38-
ui/resource/language/chat_italian.txt
39-
ui/resource/language/chat_korean.txt
40-
ui/resource/language/chat_russian.txt
41-
ui/resource/language/chat_schinese.txt
42-
ui/resource/language/chat_spanish.txt
43-
ui/resource/language/chat_tchinese.txt
36+
ui/resource/language/bugfixedhl_english.utf8.txt
37+
ui/resource/language/bugfixedhl_russian.utf8.txt
38+
ui/resource/language/chat_english.utf8.txt
39+
ui/resource/language/chat_french.utf8.txt
40+
ui/resource/language/chat_german.utf8.txt
41+
ui/resource/language/chat_italian.utf8.txt
42+
ui/resource/language/chat_korean.utf8.txt
43+
ui/resource/language/chat_russian.utf8.txt
44+
ui/resource/language/chat_schinese.utf8.txt
45+
ui/resource/language/chat_spanish.utf8.txt
46+
ui/resource/language/chat_tchinese.utf8.txt
4447

4548
ui/resource/open_source_software.txt
4649

@@ -358,21 +361,53 @@ set( SERVER_FILES
358361
)
359362

360363
function(bhl_install_files component_name file_list)
364+
set( converted_txt_files )
365+
361366
foreach( rel_file_path IN LISTS file_list)
362367
cmake_path( HAS_PARENT_PATH rel_file_path has_parent_path )
363368

364369
if( has_parent_path)
365-
cmake_path( GET rel_file_path PARENT_PATH dest )
370+
cmake_path( GET rel_file_path PARENT_PATH parent_path )
366371
else()
367-
set( dest "." )
372+
set( parent_path "." )
373+
endif()
374+
375+
if( rel_file_path MATCHES ${TXT_UNICODE_CONVERT_REGEX})
376+
# Convert file into UTF-16 LE for VGUI2
377+
string( REGEX REPLACE ${TXT_UNICODE_CONVERT_REGEX} ${TXT_UNICODE_CONVERT_REPLACE} converted_rel_file_path ${rel_file_path} )
378+
379+
file( MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${parent_path}" )
380+
set( file_to_copy "${CMAKE_CURRENT_BINARY_DIR}/${converted_rel_file_path}" )
381+
382+
add_custom_command(
383+
OUTPUT ${file_to_copy}
384+
COMMAND
385+
Python::Interpreter
386+
"${CMAKE_SOURCE_DIR}/scripts/reencode_text_file.py"
387+
"${CMAKE_CURRENT_SOURCE_DIR}/${rel_file_path}"
388+
${file_to_copy}
389+
DEPENDS
390+
"${CMAKE_SOURCE_DIR}/scripts/reencode_text_file.py"
391+
"${CMAKE_CURRENT_SOURCE_DIR}/${rel_file_path}"
392+
)
393+
394+
list( APPEND converted_txt_files ${file_to_copy} )
395+
else()
396+
# Copy the file as-is
397+
set( file_to_copy "${CMAKE_CURRENT_SOURCE_DIR}/${rel_file_path}" )
368398
endif()
369399

370400
install(
371-
FILES "${CMAKE_CURRENT_SOURCE_DIR}/${rel_file_path}"
372-
DESTINATION ${dest}
401+
FILES ${file_to_copy}
402+
DESTINATION ${parent_path}
373403
COMPONENT ${component_name}
374404
)
375405
endforeach()
406+
407+
if( converted_txt_files )
408+
# Create custom target to convert the files
409+
add_custom_target( convert_utf_files_${component_name} DEPENDS ${converted_txt_files} )
410+
endif()
376411
endfunction()
377412

378413

@@ -387,6 +422,7 @@ endfunction()
387422
# Client
388423
bhl_install_files( client "${CLIENT_FILES}" )
389424
bhl_install_target( client client "cl_dlls" )
425+
add_dependencies( client convert_utf_files_client )
390426

391427
# Server
392428
bhl_install_files( server "${SERVER_FILES}" )
-20.9 KB
Binary file not shown.
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
"lang"
2+
{
3+
"Language" "English"
4+
"Tokens"
5+
{
6+
"BHL_TeamMenu_Title" "Select Your Team"
7+
"BHL_TeamMenu_Auto_Assign" " 5 Auto Assign"
8+
"BHL_TeamMenu_Spectate" " 6 Spectate"
9+
"BHL_TeamMenu_Cancel" " 7 Cancel"
10+
"BHL_TeamMenu_NoMapInfo" "Map Description is not available."
11+
12+
"BHL_Scores_Map" "Map: "
13+
"BHL_Scores_ColSteamID" "SteamID"
14+
"BHL_Scores_ColEff" "Eff"
15+
"BHL_Scores_ColPing" "Ping" // Don't translate this as "latency". They are different things.
16+
"BHL_Scores_ColPingLoss" "Ping/Loss"
17+
"BHL_Scores_PlayerSpec" "(spectator)"
18+
"BHL_Scores_MenuMute" "Mute"
19+
"BHL_Scores_MenuUnmute" "Unmute"
20+
"BHL_Scores_MenuSteamProfile" "Open Steam profile"
21+
"BHL_Scores_MenuSteamURL" "Copy profile URL"
22+
"BHL_Scores_MenuCopyName" "Copy nickname"
23+
"BHL_Scores_MenuCopyNameRaw" "Copy raw nickname"
24+
"BHL_Scores_MenuCopySteamID" "Copy SteamID"
25+
"BHL_Scores_MenuCopySteamID64" "Copy SteamID64"
26+
27+
"BHL_Update_Notif_Title" "Update notification"
28+
"BHL_Update_Notif_Text" "A new update has been released."
29+
"BHL_Update_Notif_OldVer" "Your version: "
30+
"BHL_Update_Notif_NewVer" "Latest version: "
31+
"BHL_Update_Notif_AutoCheck" "Automatically check for updates"
32+
"BHL_Update_Notif_Install" "Install the update"
33+
34+
"BHL_Update_ErrorTitle" "Update failed"
35+
"BHL_Update_DLTitle" "Downloading the update"
36+
"BHL_Update_ExtractionTitle" "Extracting the update"
37+
"BHL_Update_HashingTitle" "Validating files"
38+
"BHL_Update_InstallingTitle" "Installing the update"
39+
"BHL_Update_UserCancel" "Installation was aborted."
40+
"BHL_Update_MetadataNotFound" "Your BugfixedHL installation is corrupted.\n\nFailed to locate metadata file.\n\nYou have to manually update the mod."
41+
"BHL_Update_InvalidModDir" "Your BugfixedHL installation is corrupted.\n\nMod directory in which BHL is installed doesn't match with the one loaded by the engine.\n\nCheck the console for details."
42+
"BHL_Update_InternalError" "An internal error has occured.\n\nCheck the console for details."
43+
"BHL_Update_MetadataCorrupted" "Your BugfixedHL installation is corrupted.\n\nYou have to manually update the mod."
44+
"BHL_Update_TempDirFailed" "Failed to create temporary directory."
45+
"BHL_Update_NoAsset" "Failed to find a compatible asset on GitHub.\n\nPlease, contact the maintainers."
46+
"BHL_Update_DLWriteOpenFailed" "Failed to open temporary download file for writing.\n\nCheck the console for details."
47+
"BHL_Update_DLFailed" "Failed to download the update.\n\n%s1"
48+
"BHL_Update_ZipOpenFailed" "Failed to open the downloaded ZIP archive.\n\n%s1"
49+
"BHL_Update_ZipExtractFailed" "Failed to extract the downloaded ZIP archive.\n\n%s1"
50+
"BHL_Update_NewMetaCorrupted" "Failed to parse metadata of downloaded update.\n\nPlease, try again later.\nIf the error persists, contact the project maintainers."
51+
"BHL_Update_HashFailed" "Failed to validate files.\n\n%s1"
52+
"BHL_Update_HashMismatch" "Failed to validate file integrity in the downloaded update.\n\n%s1\n\nPlease, try again later.\nIf the error persists, contact the project maintainers."
53+
"BHL_Update_FileConflict" "File conflict"
54+
"BHL_Update_FileConflict_Text" "A game file was manually modified. Would you like to replace it?\nAll changes would be lost."
55+
"BHL_Update_FileConflictCancel" "No files were updated yet, you are safe to cancel."
56+
"BHL_Update_Replace" "Replace"
57+
"BHL_Update_ReplaceAll" "Replace All"
58+
"BHL_Update_Keep" "Keep"
59+
"BHL_Update_KeepAll" "Keep All"
60+
"BHL_Update_InternalError2" "An internal error has occured while installing updated files.\n\nThe game may be left in an inconsistent state, BugfixedHL may require manual reinstallation.\nCheck the console for details."
61+
"BHL_Update_UpdaterDisabled" "This version of BugfixedHL requires manual installation."
62+
63+
// Advanced options
64+
"BHL_PickColor" "Pick"
65+
"BHL_GameMenu_AdvOptions" "Advanced options"
66+
"BHL_AdvOptions" "Advanced options"
67+
"BHL_ChangeLog_Title" "Changelog"
68+
69+
70+
// Adv options: HUD
71+
"BHL_AdvOptions_HUD" "HUD"
72+
"BHL_AdvOptions_HUD_Opacity" "Opacity"
73+
74+
"BHL_AdvOptions_HUD_Color" "Main color"
75+
"BHL_AdvOptions_HUD_Color_Title" "HUD Color"
76+
77+
"BHL_AdvOptions_HUD_Color1" "HP/AP/Ammo (High)"
78+
"BHL_AdvOptions_HUD_Color1_Title" "HUD HP/AP/Ammo (High) color"
79+
80+
"BHL_AdvOptions_HUD_Color2" "HP/AP/Ammo (Medium)"
81+
"BHL_AdvOptions_HUD_Color2_Title" "HUD HP/AP/Ammo (Medium) color"
82+
83+
"BHL_AdvOptions_HUD_Color3" "HP/AP/Ammo (Low)"
84+
"BHL_AdvOptions_HUD_Color3_Title" "HUD HP/AP/Ammo (Medium) color"
85+
86+
"BHL_AdvOptions_HUD_Render" "Enhanced sprite rendering *"
87+
"BHL_AdvOptions_HUD_Dim" "Dim HUD when inactive"
88+
"BHL_AdvOptions_HUD_MenuFKeys" "Use F1-F10 in HUD menus"
89+
"BHL_AdvOptions_HUD_WeapSprite" "Display weapon sprite"
90+
"BHL_AdvOptions_HUD_CenterId" "Center player name hint"
91+
"BHL_AdvOptions_HUD_Rainbow" "Enable Rainbow HUD™"
92+
93+
"BHL_AdvOptions_HUD_Speed" "Show speedometer"
94+
"BHL_AdvOptions_HUD_SpeedCross" "Speedometer under crosshair"
95+
"BHL_AdvOptions_HUD_JumpSpeed" "Show last jump speed"
96+
"BHL_AdvOptions_HUD_JumpSpeedCross" "Jump speed under crosshair"
97+
98+
"BHL_AdvOptions_HUD_Deathnotice" "VGUI2 Deathnotice *"
99+
100+
"BHL_AdvOptions_HUD_RenderMsg" "* Requires hardware rendering mode"
101+
102+
"BHL_AdvOptions_Hud_Timer" "Show timer at the top of the screen"
103+
"BHL_AdvOptions_Hud_Timer0" "Never"
104+
"BHL_AdvOptions_Hud_Timer1" "Time Left"
105+
"BHL_AdvOptions_Hud_Timer2" "Time Passed"
106+
"BHL_AdvOptions_Hud_Timer3" "Local time"
107+
108+
"BHL_AdvOptions_Hud_Scale" "HUD Scale (req. restart)"
109+
"BHL_AdvOptions_Hud_ScaleAuto" "Auto"
110+
111+
112+
// Adv options: Chat
113+
"BHL_AdvOptions_Chat" "Chat"
114+
"BHL_AdvOptions_Chat_ChatStyle" "Chat style"
115+
"BHL_AdvOptions_Chat_ChatStyle1" "VGUI2"
116+
"BHL_AdvOptions_Chat_ChatStyle2" "Old (bottom)"
117+
"BHL_AdvOptions_Chat_ChatStyle3" "Old (top)"
118+
"BHL_AdvOptions_Chat_V2Label" "VGUI2 chat options"
119+
"BHL_AdvOptions_Chat_Time" "New messages will disappear after N seconds"
120+
"BHL_AdvOptions_Chat_Mute" "Mute all comms"
121+
"BHL_AdvOptions_Chat_MuteLabel" "Muted players in the scoreboard will be muted in the chat"
122+
"BHL_AdvOptions_Chat_Sound" "Chat sound"
123+
"BHL_AdvOptions_Chat_SoundLabel" "Play a sound on new chat message"
124+
"BHL_AdvOptions_Chat_Display" "Enable chat"
125+
"BHL_AdvOptions_Chat_Displaylabel" "Display new messages on the screen"
126+
127+
128+
// Adv options: Crosshair
129+
"BHL_AdvOptions_Cross" "Crosshair"
130+
"BHL_AdvOptions_Cross_Enable" "Enable customizeble crosshair"
131+
"BHL_AdvOptions_Cross_Color" "Color"
132+
"BHL_AdvOptions_Cross_Color_Title" "Crosshair Color"
133+
"BHL_AdvOptions_Cross_Gap" "Gap"
134+
"BHL_AdvOptions_Cross_Size" "Size"
135+
"BHL_AdvOptions_Cross_Thickness" "Thickness"
136+
"BHL_AdvOptions_Cross_OutThickness" "Outline thickness"
137+
"BHL_AdvOptions_Cross_Dot" "Show dot in the middle"
138+
"BHL_AdvOptions_Cross_T" "Remove top line (look like letter T)"
139+
140+
141+
// Adv options: Scoreboard
142+
"BHL_AdvOptions_Scores" "Scoreboard"
143+
"BHL_AdvOptions_Scores_ShowAvatars" "Show avatars"
144+
"BHL_AdvOptions_Scores_ShowSteamId" "Show SteamID"
145+
"BHL_AdvOptions_Scores_ShowLoss" "Show packet loss"
146+
147+
"BHL_AdvOptions_Scores_ShowEff" "Show efficiency"
148+
"BHL_AdvOptions_Scores_EffType" "Efficiency type:"
149+
"BHL_AdvOptions_Scores_EffType0" "K/D -- K / D"
150+
"BHL_AdvOptions_Scores_EffType1" "K/L -- K / (D + 1)"
151+
"BHL_AdvOptions_Scores_EffType2" "RCD/NGHL -- K / (K + D)"
152+
153+
"BHL_AdvOptions_Scores_Mouse" "Context menu mouse button:"
154+
"BHL_AdvOptions_Scores_Mouse0" "None"
155+
"BHL_AdvOptions_Scores_Mouse1" "Left mouse button"
156+
"BHL_AdvOptions_Scores_Mouse2" "Right mouse button"
157+
158+
"BHL_AdvOptions_Scores_Size" "Scoreboard size:"
159+
"BHL_AdvOptions_Scores_Size0" "Automatic"
160+
"BHL_AdvOptions_Scores_Size1" "Always large"
161+
"BHL_AdvOptions_Scores_Size2" "Always compact"
162+
163+
"BHL_AdvOptions_Scores_ShowInHud" "Show a mini-scoreboard in HUD\nMaximum number of rows:"
164+
165+
166+
// Adv options: General
167+
"BHL_AdvOptions_General" "General"
168+
"BHL_AdvOptions_General_FOV" "Field of View"
169+
"BHL_AdvOptions_General_InputWin" "Windows Cursor"
170+
"BHL_AdvOptions_General_InputDX" "DirectInput"
171+
"BHL_AdvOptions_General_InputSDL" "Raw Input"
172+
"BHL_AdvOptions_General_InputRec" "(recommended)"
173+
"BHL_AdvOptions_General_Input" "Mouse input method"
174+
"BHL_AdvOptions_General_KillSnd" "Kill Sound"
175+
"BHL_AdvOptions_General_KillSnd2" "Play a sound when you get a kill"
176+
"BHL_AdvOptions_General_HTML" "Allow HTML MOTD"
177+
"BHL_AdvOptions_General_HTML2" "Enable HTML in Message Of The Day dialog"
178+
"BHL_AdvOptions_General_AutoJump" "Auto-jump"
179+
"BHL_AdvOptions_General_AutoJump2" "Enable auto jumping when spacebar is held"
180+
"BHL_AdvOptions_General_LogChat" "Log player chat"
181+
"BHL_AdvOptions_General_LogChat2" "Write player chat messages to the log"
182+
"BHL_AdvOptions_General_LogOther" "Log other chat"
183+
"BHL_AdvOptions_General_LogOther2" "Write non-player chat messages to the log"
184+
"BHL_AdvOptions_General_AutoDemo" "Record Demos"
185+
"BHL_AdvOptions_General_AutoDemo2" "Demos are recorded at the start of a game"
186+
"BHL_AdvOptions_General_KeepFor" "Keep saved demos for"
187+
"BHL_AdvOptions_General_Days" "days"
188+
189+
190+
// Adv options: About
191+
"BHL_AdvOptions_About" "About"
192+
"BHL_AdvOptions_About_BHL" "Bugfixed and Improved Half-Life Release"
193+
"BHL_AdvOptions_About_Version" "Version: "
194+
"BHL_AdvOptions_About_NewVersion" "Latest version: "
195+
"BHL_AdvOptions_About_NoUpdater" "N/A (updater not enabled)"
196+
"BHL_AdvOptions_About_Unknown" "N/A"
197+
"BHL_AdvOptions_About_NewUpdate" "An update is available."
198+
"BHL_AdvOptions_About_NewUpdate2" "Go to GitHub to download the update."
199+
"BHL_AdvOptions_About_Check" "Check for updates"
200+
"BHL_AdvOptions_About_Changelog" "Show changelog"
201+
"BHL_AdvOptions_About_AutoCheck" "Automatically check for updates"
202+
"BHL_AdvOptions_About_GitHub" "Visit GitHub repository (releases, wiki, etc)"
203+
"BHL_AdvOptions_About_AGHL" "Visit AGHL.ru discussion forum"
204+
"BHL_AdvOptions_About_OSSCredits" "Used Open Source software"
205+
206+
207+
// Adv options: Models
208+
"BHL_AdvOptions_Models" "Models"
209+
"BHL_AdvOptions_Models_EnemyModels" "Allowed enemy models:"
210+
"BHL_AdvOptions_Models_ModelName" "Model"
211+
"BHL_AdvOptions_Models_Add" "+"
212+
"BHL_AdvOptions_Models_Remove" "Remove"
213+
"BHL_AdvOptions_Models_RemoveAll" "Remove All"
214+
"BHL_AdvOptions_Models_TeamModel" "Replaced teammate model:"
215+
"BHL_AdvOptions_Models_EnemyColors" "Replaced enemy colors (e.g. \"90 30\"):"
216+
"BHL_AdvOptions_Models_TeamColors" "Replaced teammate colors (e.g. \"90 30\"):"
217+
"BHL_AdvOptions_Models_HideCorpses" "Hide corpses"
218+
"BHL_AdvOptions_Models_LeftHand" "Left-handed weapons"
219+
"BHL_AdvOptions_Models_AngledBob" "Angle weapon when moving"
220+
"BHL_AdvOptions_Models_NoShells" "Disable weapon shells"
221+
"BHL_AdvOptions_Models_NoViewmodel" "Hide weapon view model"
222+
}
223+
}
-21.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)