CSV File Format - Stringtables: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Redirection to Stringtable.csv)
 
(41 intermediate revisions by 17 users not shown)
Line 1: Line 1:
==CSV (comma separated values)==
#REDIRECT [[Stringtable.csv]]
Because of the unfortunate, but perfectly reasonable, filename extension, people associate this file as something to do with Micro$oft Excell and spreadsheets.
 
In a very limited way, this file ''is'' spreadsheet data, but, to use '''a''' spreadsheet tool for it is a) erroneous, b) ridiculous.
 
{{Important|Use your notepad editor for these file types}}
 
===Purpose===
csv files are used in Operation Flashpoint exclusively as a language translator.
 
Although the engine uses differently named csv's, ''the'' csv for missions, addons, and campaigns is hardwired to '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.
 
 
==Why Bother?==
 
Well if you can't be bothered, stop reading, but, there are two abundantly clear reasons for anyone serious about the missions (or addons) they make. Without a stringtable.csv, you're not 'proud' about your creation:
 
#Save yourself the agony of hunting through your scripts and missions and blah looking for that 'thing' you wrote but umm err, well hell, where did i put it.
#If you want to internationalise your mission, making it more appealable, more playable by '''everyone''', use stringtables.
 
==Layout==
 
===Intent===
The basic idea is that any language is in columns. English in one column, French in another. The order (whether French or English) comes first is immaterial. <u>It is the column that is all-important</u>
 
 
===Basics===
The very first line of any csv must contain the statement
 
LANGUAGE,  Polish, Hungarian, Turkish,,,,,.
 
It should not take rocket science for you to substitute the above 'languages' with something more pertinent. The point being illustrated is that you can add any language!!!! That's right. ANY language.
 
From then on, the csv file contains lines of substitute text. Substitute means, it will replace in the game, a piece of text, from a given column. An example
 
Language,  English,Turkish,French,Comment
STR_BROKEN,Broken, Bozuk,  Merde, dunno
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!
 
{{Important|The second column (the first 'string') is the default.}}
 
You can be guaranteed that the 2nd column is fully filled for '''all''' string tokens. It is, after all, the beginning piece for the author for any language he cares to write in. Thus, for a ''Polish'' author making a ''Polish'' mission, you can be certain, the 2nd column is declared as Polish and all strings defined. (and this becomes the default language for the engine when playing the 'mission')
 
Secondly, '''the only criteria is the comma'''. "Merde Encore" does ''not'' require quotes.
 
{{Important|The only use of quotes in a csv file are to pervert commas.}}
 
Thus for the phrase "Merde, Encore" you ''would'' need quotes.
 
3rd, the language 'Comment' is just as valid as any other, the engine can handle the 'Comment' language, anything placed there would be shown (which would be, let's say, a little odd). Whether you choose to add a comment column is up to you and mostly unnecessary.
 
You can choose to have as many or as little languages as you like. The only criteria is you must have one language minimum. The default one in the second column when nothing else exists.
 
Finally, when forming phrases, the text used by the engine  is from the first <u>non space character</u> after a comma, until the <u>last non space character</u> 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      ,
 
are both clipped to the first form.
 
This is very helpful to you if you want to keep columns aligned (tabbed).
 
 
==Usage==
One example should suffice
 
in mission.sqm and scripts (eg):
text = "Alexi's sister\nAlexi's mother\nMy brother";
text = $STR_FAMILY;
 
for markers:
@STRD_example
 
in stringtable.csv
 
STR_FAMILY,  Alexi's sister\nAlexi's mother\nMy brother, blib\n\blab\blob, more more more
 
Note the requirement for $STRxyz and STRxyz and that should be it for anything you care to place in a stringtable.
 
==Comments==
//Essentially, any syntax the engine cannot understand, becomes a comment, a non event, a non-part, of the columns. By
// convention the // as illustrated here is used. However, in practice
 
{{Important|Anything that doesn't start with STR can only be a comment!}}
 
 
==THE SELECTED language==
flahspoint.cfg in the root directory of your operation flashpoint folder contains THE language you prefer to use.
The statement
Language="English";
 
could not be more simple, or more obvious on what to change (if you want to) You can, if it suits you write
 
Language = "Pongolian"
 
and create stringtable.csv's specifically written in Pongolian. For more information on this subject read [[Language Selection]].
 
 
==Replacing original game texts==
 
In mission is possible to replace every original game text which is defined in global stringtable.csv file of (\res\bin\stringtable.csv) and which is loaded on the mission start (all the other texts, including addon names or some GUI texts, cannot be changed). These text are for example radio texts, some GUI parts (red text after death), briefing chapters (Plan, Notes, Gear, Group) and many others.
 
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]]).
 
 
'''Notes:'''
*There are instances where the radio name will revert to the default after a reload of the mission.
 
 
[[category:Operation Flashpoint: Editing]]

Latest revision as of 02:56, 7 May 2018

Redirect to: