W3strings

From Witcher Wiki
Jump to: navigation, search

The .w3strings extension is used to denote files that contain compressed localization data for The Witcher 3: Wild Hunt. Uncompressed, you can think of this data as being organized as a series of key-value pairs, with the key being a language-independent string ("master_volume") and the value being the localized version (english: "Master Volume"). In reality, they are organized somewhat differently[How?].

Mods can include .w3strings files in their folder structure that will add localization entries or modify existing ones. This is particularly useful if you want to add a menu for your mod, have some other display strings (such as for the combat log) that you want to be localized, or you want to change the existing text in the game, such as changing the name of an item.

w3strings encoder[edit | edit source]

A command-line tool by rmemr is available here that will encode (from a .csv file) and decode .w3strings files (to a .csv file).

Id Spaces[edit | edit source]

To minimize collisions, the tool splits the localization ids into bins, each denoted by an id space. This id space is an identifier for your localized mod, and rmemr suggests that you use the Nexus Mod ID for your mod as your id. This binning also restricts modders to a hefty 1000 localization entries for each mod. More information is available in his CDPR forum thread

Usage[edit | edit source]

Example Encode Usage
w3strings.exe --encode example.en.csv --id-space 9999
DO NOT USE ID 9999 FOR YOUR MOD! IT IS RESERVED AS AN EXAMPLE ID.
Example Decode Usage
w3strings.exe --decode example.en.csv.w3strings

Real-World Example[edit | edit source]

This is an example ripped from Enhanced Targeting. For more info on prefixes used for menus, have a look at the menus article.

locale.en.csv[edit | edit source]

;meta[language=en]
; id      |key(hex)|key(str)| text
;
; comment lines use ; as first character
; all comment lines (except the two line header) will be ignored
; Enhanced Targeting's Nexus ID is 1432 so left is 211-1432-xxxx
2111432000|        |panel_Mods|Mods
2111432001|        |panel_et_name|Enhanced Targeting
2111432002|        |preset_Mods_et_name|Enhanced Targeting Defaults
2111432003|        |preset_value_et_default_kb|Default (KB & M)
2111432004|        |preset_value_et_default_controller|Default (Controller)
2111432005|        |option_et_enabled|Enabled
2111432006|        |option_et_camera_weight|Camera Direction Weight
2111432007|        |option_et_movement_weight|Movement Direction Weight
2111432008|        |option_et_facing_weight|Facing Direction Weight
2111432009|        |option_et_hysteresis|Hysteresis (Target Stickiness)
2111432010|        |option_et_in_frame_check|In-Frame Check
2111432011|        |option_et_cast_towards_camera|Cast Signs Towards Camera
2111432012|        |option_et_disable_camera_lock|Disable Camera Lock on Target Lock
2111432013|        |option_et_version|Version
2111432014|        |preset_et_name|Enhanced Targeting Defaults

Encoding into locale.en.w3strings[edit | edit source]

w3strings.exe --encode locale.en.csv --id-space 1432

Batch Script For Encoding All Language Files[edit | edit source]

set my_id=9999
call w3strings.exe—encode raw_files\ar—id-space %my_id%
call w3strings.exe—encode raw_files\br—id-space %my_id%
call w3strings.exe—encode raw_files\cz—id-space %my_id%
call w3strings.exe—encode raw_files\de—id-space %my_id%
call w3strings.exe—encode raw_files\en—id-space %my_id%
call w3strings.exe—encode raw_files\es—id-space %my_id%
call w3strings.exe—encode raw_files\fr—id-space %my_id%
call w3strings.exe—encode raw_files\hu—id-space %my_id%
call w3strings.exe—encode raw_files\it—id-space %my_id%
call w3strings.exe—encode raw_files\jp—id-space %my_id%
call w3strings.exe—encode raw_files\kr—id-space %my_id%
call w3strings.exe—encode raw_files\ru—id-space %my_id%
call w3strings.exe—encode raw_files\zh—id-space %my_id%
call w3strings.exe—encode raw_files\pl—id-space %my_id%
pause

This batch script will encode all raw files placed in encoder folder\raw_files. Note however that they are renamed so each file name contains only two letters identifying language, there is not even .csv format. (of course they are csv it's just not in the filename) This way all files are encoded to language_name.w3strings so you can just place them in your mod without renaming after encoding.

Just set id you're using in the strings in the first line.