====== OFP Stringtable.csv File Format ====== [[https://www.pmctactical.org/forum/viewforum.php?f=43|OFP Forum]], [[:ofp|OFP Home]], [[ofp:file_formats|OFP File Formats]], [[ofp:tools|OFP Tools]], [[ofp:missions|OFP Missions]], [[ofp:modeling|OFP 3D Modeling]], [[ofp:terrain|OFP Terrain]] **Operation Flashpoint (OFP)** aka ArmA: Cold War Assault (CWA) Stringtables are used to make internationalization easier for the game itself, as well as addons, missions, scripts, etc. Any messages and strings that are used in the game are kept separate from the code, and can therefor easily be edited and expanded. Instead of using message strings directly in the code you are using a variable instead. This variable will then contain the actual string, read from stringtable.csv, with the language that's being read depending on the game settings. ====== CSV (Comma Separated Values) ====== The file stringtable.csv is an ASCII text file, and can be edited with any text editor. One //could// theoretically use a spreadsheet program (like Excel) to edit the file, but that would be serious overkill. //DO NOT// use a word processor (like MS-Word, or Write) to edit this file though, as it will corrupt it, unless you are very knowledgeable and careful. Operation Flashpoint and VBS1 use ANSI encoding, codepage is defined by the font used. Armed Assault and VBS2 use [[https://en.wikipedia.org/wiki/UTF-8|UTF-8]] encoding, or you can provide the file in [[https://en.wikipedia.org/wiki/Unicode|Unicode]] as well, in which case it will be converted to UTF-8 when loading. ====== Function ====== CSV files are used in Operation Flashpoint exclusively as a string lookup tables. Although the engine uses other files with the extension CSV, the file for missions, addons, and campaigns is 'stringtable.csv' and **must** be located in the primary folder of the mission, the addon, or, the campaign. In point of fact, the naming convention inside a csv is such that the first three letters of any variable (more later) must begin with STR, and referenced in mission.sqm, description,ext or anywhere else as $STRsomething. The characters STR tell the engine to look in 'stringtable.csv' as opposed to somewhere else. ====== Format ====== The basic idea is that every language is assigned one column. (e.g. English has one column, French has another.) The order of the columns doesn't matter. (i.e. whether English comes first, or French, or Czech, is irrelevant.) The very first line of any csv must contain a statement like this: LANGUAGE, Polish, Hungarian, Turkish With this line you define the order in which the language columns are arranged. You can have as many or as few as you like. Below this line the CSV file contains one line for each string definition; starting with the string //name//, and followed by the translations for the different languages: Language, English,Turkish,French STR_BROKEN,Broken, Bozuk, Merde STR_GOOD, Good, Guzel, STR_BAD, Bad, Hayar, Merde Encore STR_ONE, One, , Une Note some interesting and highly flexible aspects of the above syntax. There is **no** French equivalent for STR_GOOD. Nor is there a Turkish equivalent for ONE. The engine will default to the 2nd column. It happens to be 'English', but need not be! **The second column (the first 'string') is the default.** Because of that, it is important that //all// of the 2nd columns are filled! The second column doesn't //have// to be English - it can be any language the author is most comfortable with, and for which he will be able to supply //all// the required definitions. In that case though, he will have to adjust the "LANGUAGE, ..." column definition at the top of the file. To separate strings from one another, commas are used. String do not have to be enclosed with quotation marks. In the case that commas are needed in the string definition itself, then that string would have to be enclosed by quotes (e.g. "Merde, Encore" you //would// need quotes.) Finally, when defining a string, the text used by the engine is from the //first non space character// after a comma, until the //last non space character// before the next comma (or end of line). This would be familiar to many programmers as the Trim() function. Thus ,this is a text, , this is a text , would both return //"this is a text"//. This feature is helpful if you want to keep columns aligned (tabbed), to keep better track of the columns. ====== Usage ====== Definition in stringtable.csv: LANGUAGE, English, German STR_MOVETO, Move to the, Gehen sie zum STR_STATION, railroad station, Bahnhof STR_AIRPORT, airport, Flughafen * Usage in scripts (activations and conditions too) * ArmA _text = [[localize]] STR_MOVETO + " " + [[localize]] STR_AIRPORT; * OFP _text = $STR_MOVETO + " " + $STR_AIRPORT * Usage in description.ext $STR_AIRPORT * Usage in mission.sqm (markers, texting effects, mission name...): @STR_AIRPORT ====== Comments ====== Any syntax the engine cannot understand is interpreted as a comment. By convention the double-forward slash (double /) at the beginning of the line is used: LANGUAGE, English, German // actions STR_MOVETO, Move to the, Gehen sie zum STR_DESTROY, Destroy the, Zerstören sie den // locations STR_STATION, railroad station, Bahnhof STR_AIRPORT, airport, Flughafen However, in practice anything that //doesn't// start with STR can only be a comment. ====== The Selected Language ====== flashpoint.cfg in the root directory of your operation flashpoint folder defines the language to be used for your installation: Language="English"; This can be changed to any language that has valid entries in the stringtable.csv's. ====== Replacing original game texts ====== It is possible to replace every message of the original game by editing the global stringtable.csv file (in \res\bin\stringtable.csv). (Some messages, like addon names some GUI texts, briefing chapters (Plan, Notes, Gear, Group), etc. //cannot// be changed via the stringtable.csv though). For example, you can create custom radio names for your squads. Create your group and give them a normal radio name with the following command in the init line of the commander. this [[setGroupId]] ["Alpha", "GroupColor0"]; Now, in your **stringtable.cvs** add; STR_CFG_GRPNAMES_ALPHA, "Your group name", STR_CFG_GRPCOL_BLACK, "Your color name", Where //Your group name// is the custom name you'd like your squad radio messages to have, //Your color name// is color of the squad (GroupColor0 is Black, for more details see setGroupId). ====== Different sounds under different languages ====== You can use //stringtable.csv// not only for texts but sounds and other description.ext classes. See example: stringtable.csv LANGUAGE,"Polish","English" STR_R1,"POLSKI","ENGLISH" STR_R2,"TUTAJ POLSKI ?O?NIERZ.","US AND A SOLDIER HERE." STR_RadioMsg1,"POL\R1.WAV","ENG\R1.WAV" STR_RadioMsg2,"POL\R2.WAV","ENG\R2.WAV" Of course all sounds we have in //Sound// directory. Moreover they are in two different folders: //POL// and //ENG//. It makes //Sound// more clean. You can use prefixes like: //eng_// or //pol_// insted. description.csv (CfgRadio class only) class CfgRadio { sounds[] = {}; class R1 { name = "Radio #01"; sound[] = {$STR_RadioMsg1, db+10, 1.0}; title = $STR_R1; }; class R2 { name = "Radio #02"; sound[] = {$STR_RadioMsg2, db+10, 1.0}; title = $STR_R2; }; }; How it works? During loading, description.ext exactly, all string values preceeded with //$// (dolar) are changed on right entires from //stringtable.csv//. So when a player run game under English language, he (or she) will have english texts and sounds. The same think with Polish and other specefied languages. This solution you can use for CfgIdentities class to create personages with translated names or even native faces. **Notes:** * There are instances where the radio name will revert to the default after a reload of the mission.