Difference between revisions of "HPL3/Language Configuration"
m |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
The content of a language files is divided into '''categories''', each category holds language '''entries'''. A language entry holds the actual text information. The following is an example of a simple language file:<syntaxhighlight lang="xml"> | The content of a language files is divided into '''categories''', each category holds language '''entries'''. A language entry holds the actual text information. The following is an example of a simple language file:<syntaxhighlight lang="xml"> | ||
<LANGUAGE> | <LANGUAGE> | ||
− | < | + | <Category Name="HelloWorld"> |
<Entry Name="HelloWorld">Hello World!</Entry> | <Entry Name="HelloWorld">Hello World!</Entry> | ||
− | </ | + | </Category > |
</LANGUAGE> | </LANGUAGE> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 20: | Line 20: | ||
|Each language file begins and closes with a <code><LANGUAGE></code> tag. | |Each language file begins and closes with a <code><LANGUAGE></code> tag. | ||
|- | |- | ||
− | | | + | |Category |
− | |A category | + | |A language category. Inside, all of the language entries will be listed. |
+ | |- | ||
+ | |Category Name | ||
+ | |A category must have an internal name so it can be picked up by the game script and read data from. | ||
|- | |- | ||
|Entry | |Entry | ||
|A language entry tag. This holds the actual text information <code>Hello World!</code> | |A language entry tag. This holds the actual text information <code>Hello World!</code> | ||
|- | |- | ||
− | |Name | + | |Entry Name |
|The name of the entry. Each entry needs to have a name attribute so the game will be able to read the text from it. | |The name of the entry. Each entry needs to have a name attribute so the game will be able to read the text from it. | ||
|} | |} | ||
Line 41: | Line 44: | ||
'''The file should be located inside the mod's <code>config/lang</code> folder, unless specified otherwise in the [[HPL3/Launch Configuration|Launch Configuration file]].''' | '''The file should be located inside the mod's <code>config/lang</code> folder, unless specified otherwise in the [[HPL3/Launch Configuration|Launch Configuration file]].''' | ||
− | === Overriding Existing Language File Categories === | + | ===Overriding Existing Language File Categories=== |
− | + | It is possible to override the main game's language categories and entries. It is useful if you want to change default values for certain text, or if you want to add new entries to a category. To override a main game language category simply create the same category in your own language file. | |
+ | {{note|If you do not need to change the content of a certain category in your language file, do not copy it.}} | ||
+ | |||
+ | ==== Example ==== | ||
+ | ''Main game <code>english.lang</code> language file:''<syntaxhighlight lang="xml"> | ||
+ | <CATEGORY Name="GameOver"> | ||
+ | <Entry Name="DefaultMessage">You died</Entry> | ||
+ | <Entry Name="PressToContinue">Press any button to try again...</Entry> | ||
+ | </CATEGORY> | ||
+ | </syntaxhighlight>''Mod's <code>english.lang</code> language file:''<syntaxhighlight lang="xml"> | ||
+ | <CATEGORY Name="GameOver"> | ||
+ | <Entry Name="DefaultMessage">You are dead. Not big surprise.</Entry> | ||
+ | <Entry Name="PressToContinue">press to continue or something idk</Entry> | ||
+ | </CATEGORY> | ||
+ | </syntaxhighlight>The game will use our custom <code>GameOver</code> category instead of the category from the main game language file, because we override it in our language file. | ||
+ | |||
+ | ==Editing Language Files== | ||
+ | {{constructionNotice|This is a work in progress section.}} | ||
+ | The best way to create, edit, and modify language entries and language files, is to use the Language Editor. This editor comes with the game installation and is named <code>LangEditor.exe</code>. | ||
+ | |||
+ | === Loading a Language File === | ||
+ | |||
+ | === Adding a Language Category === | ||
+ | |||
+ | === Adding a Language Entry === | ||
[[Category:Modding]] | [[Category:Modding]] | ||
[[Category:English]] | [[Category:English]] |
Latest revision as of 21:34, 6 November 2020
When displaying any kind of text on the screen (For example, when picking up a note and reading it), the mod refers to a file in which that text information is stored in. That file is called a language file. Each language has their own language files. For example, if your mod has English and Czech translations, you will have separate English and Czech language files.
Contents
Setting Up Language Files
When configuring a language for a mod, you need to have two separate files: a base language file, and a main language file. For example, if your mod has English and Czech languages, you will have 4 language files in total. A language file's extension ends with .lang
The content of a language files is divided into categories, each category holds language entries. A language entry holds the actual text information. The following is an example of a simple language file:
<LANGUAGE>
<Category Name="HelloWorld">
<Entry Name="HelloWorld">Hello World!</Entry>
</Category >
</LANGUAGE>
Attribute | Description |
---|---|
LANGUAGE | Each language file begins and closes with a <LANGUAGE> tag.
|
Category | A language category. Inside, all of the language entries will be listed. |
Category Name | A category must have an internal name so it can be picked up by the game script and read data from. |
Entry | A language entry tag. This holds the actual text information Hello World!
|
Entry Name | The name of the entry. Each entry needs to have a name attribute so the game will be able to read the text from it. |
Base Language File
The base language file holds text related to the main menu, key configuration, and general menu messages. It has a prefix base_
in the name. For example, a base English language file will be named like this: base_english.lang
.
The file should be located inside the mod's config
folder, unless specified otherwise in the Launch Configuration file.
Main Language File
The main language file holds text related to in-game readables (such as notes), level names, game hints, item descriptions, etc. The name of file depends on the language it refers to. For example, an main English language file will be named like this: english.lang
.
The file should be located inside the mod's config/lang
folder, unless specified otherwise in the Launch Configuration file.
Overriding Existing Language File Categories
It is possible to override the main game's language categories and entries. It is useful if you want to change default values for certain text, or if you want to add new entries to a category. To override a main game language category simply create the same category in your own language file.
Example
Main game english.lang
language file:
<CATEGORY Name="GameOver">
<Entry Name="DefaultMessage">You died</Entry>
<Entry Name="PressToContinue">Press any button to try again...</Entry>
</CATEGORY>
Mod's english.lang
language file:
<CATEGORY Name="GameOver">
<Entry Name="DefaultMessage">You are dead. Not big surprise.</Entry>
<Entry Name="PressToContinue">press to continue or something idk</Entry>
</CATEGORY>
The game will use our custom GameOver
category instead of the category from the main game language file, because we override it in our language file.
Editing Language Files
The best way to create, edit, and modify language entries and language files, is to use the Language Editor. This editor comes with the game installation and is named LangEditor.exe
.