Guide to Translations

Suggestions, issues and any questions related to translation mods
Post Reply
Zodd
Developer
Posts: 117
Joined: Thu Jul 28, 2016 11:33 am

Thu Aug 04, 2016 6:01 pm

This is a guide explaining in detail how to create translations for Kenshi.

Introduction:
Translations can be done in two ways; as a normal translation (in the 'locale' folder) or as a mod that includes the translation (Mod translation).
The difference between them is that the normal one can be changed from a specific list in the launcher (see image below) and allows translations of the launcher text, however, it needs to be placed manually in the game folder.
The advantage of being a mod is the easiness that brings the Steam Workshop for uploading and keep it up to date.
The decision is up to you.
Image

Note: It's not recommended to combine both options.

All the displayed strings come from two places: the source code (SC) and and the game data (in the Forgotten Construction Set (FCS)).
The SC's strings are mostly messages, titles, and similar stuff. The strings in game data are basically all the game content and the dialogue (everything in the FCS).
Both of this are handled different; the SC strings are loaded using a specific library (more on that below) while the game data are loaded similar to a mod (with a different extension).

Format:
The strings to be translated are generated using the 'Boost Locale' library that uses GNU gettext formatting.
There are a bunch of tools and editors to translate and update the files quite easily.
  • Files:
    There are three types that are handled: pot, po and mo.
    • 'pot' (Portable Object Template) file, which contains a list of all the translatable strings extracted from the sources and game data.
    • 'po' (Portable Object) file contains the translated strings (from the .pot file) for a specific language. This files are created (an can be updated) from a .pot file.
    • 'mo' (Machine Object) file contains the binary-compiled .po translation file.
    This last file is the one that needs to be distributed in your translation since it's the one that the game will load. (Only for the SC strings).

    If you want more info on the format or how it works you can google it.
  • Folder's naming:
    The format for the locale content folder will use the structure 'language_COUNTRY' where language is ISO-639 language name like "en" or "ru", COUNTRY is the ISO-3166 country identifier like "US" or "DE". The country identifier is optional if you want to make a country specific translation for the same language.
    Examples: de_DE, zh_HANS, ru_RU, es_ES, en_US.
    Note: If the country is not added to the name, the number formatting, like decimal and thousands separators, won't be display in the locale.
Tools:
There are a few tools for translating this files:
  • I've recommend Poedit; it handles creating new translations as well as updating from a pot file.
  • There is also Google Translator Toolkit online tool that allows collaboration with multiple people (like a Google Doc file) and some other features. If you want to use this last one, since for some reason it doesn't support the .pot extension, you need to change the extension from .pot to .po from the base files when you upload them.
Getting started:
There are two ways of translating the game data strings (the ones in the FCS); one is creating a normal mod and replace all the names, descriptions, dialogue lines, etc. by hand.
The other option is to use the FCS tool to extract all the base strings (i.e. non-dialogue) strings to a pot file and the translation mode in the FCS to do the dialogue lines.
The latter is a better option since it will extract strings that are used in game in the pot format and it provides an easier way to translate dialogue.

Note: Technically both options are compatible with both ways of doing translations as described in the introduction.
  1. Introduction
    The translation of the game data is splitted in to parts; one is the base game data (everything that is not a dialogue) and the dialogue.
    The base game data is extracted to a POT for easier translation. It has only the used strings and there are no repeated lines.
    The dialogue translation is done using the Translation mode in the FCS. It works similar to the normal FCS mode except it will only show used dialogues and words swaps, an for each of them, it'll show the original and translated string.
    Note: To extracts the base game data strings is also needed to be in Translation Mode in the FCS.

    Since the SC's strings are already shipped with the game (in the file 'main.pot' that is located in 'Kenshi\locale\en_GB\LC_MESSAGES'), you'll need to decide if you want to extract the game data strings or make a mod directly as commented above.
    The decision is up to you.
    This guide will asume that you'll use the Translation Mode in the FCS.
  2. Activate 'Translation Mode':
    1. Open FCS
      Image
      Or open "forgotten construction set.exe" in the Kenshi folder.
    2. Check the checkbox 'Enable' on the bottom part. (Note: If you load any other mod, the content of that mod will also be extracted and is not recommended)
      Image
      You can add a new translation or select an existing one to update.
      The translation files will be in Kenshi\__translations\<locale>\ folder.
  3. Extracting strings:
    To extract the game data strings follow this steps:
    1. Press the toolbar button 'Translations'
      Image
    2. Press "Export" button.
      Image
    Once complete it will create a bunch of .pot files in Kenshi\__translations\<locale>\ folder.
    Image

    The gamedata.pot contains all the items, buildings, races, towns, etc. names and descriptions (if they have).
    Image

    Note: If the "Export dialogue" option is selected, it will export the dialogue lines to .pot files in the dialogue folder.

    Important note: There are text files in the data folder like 'tips.txt', 'namesF.txt', etc. that need to be directly translated (without using the .pot/.po format) (See part 4 for how to include them).
  4. Translating:
    Game base data:
    You'll need to create a translation (.po) file for the gamedata.pot file. You can use the Poedit or any similar tool to do this.

    Translation notes: In the strings, the content inside braces ({}) represents some value that is replaced in game with some other content. It can be from numbers, names, actions, etc. The braces plus their content should not be modified, although the can be placed in different location in the text. E.g.: "Lockpicking (Chance {1}%)" in Spanish could be translated as: "Forzando cerradura ({1}% de probabilidad)".
    Alseo, all non-translated strings (empty string "") in the .po files will be show the original string in English (both from the main.po and the game data extracted/build from the FCS).

    Dialogue:
    When opening the FCS in Translation Mode, it will show the main window with just to categories: Dialogues and Word Swaps.
    Image

    To translate them, just double click on one and it will display the following window:
    Image

    The top bar displays information for the selected dialogue node, like who is speaking, if the target is a specific type/race/gender or meets other conditions. This information gives better context for when translating.

    On the bottom left is the dialogue tree with the respones/paths for the dialogue. If the node has a red dotted rectangle around the name it means that there are strings that need translating yet. Whether because they wheren't translated yet or if the base string changed.

    On the bottom right displays all the possible variations for the selected node. All of them have the same probability of showing in game when the node is executed.
    If the line is blue, it means that the line needs translation (the same as the node). Once all the lines are translated, the node red dotted rectangle will disappear.
    Important note: To apply the translation is necessary to press "Enter", otherwise the changes won't apply. This also applys for lines that stay the same when translated.

    Image

    Translation notes: Some lines in the dialogue contains strings in between slashes (/) like /HELL/ or /YOUTHERE/, this represent word swaps. This word swaps are randomly or context-based replaced in game by other words. Similar to the braces, this should be maintained the same inside and can be moved.

    Word swaps:
    The word swaps are dialogue lines that contain swapping words for the main dialogue.
    As with the dialogue, they have different lines with conditions.
  5. Importing:
    To import the translated gamedata.po file into the translation mod, follow this steps:
    1. Place the translated gamedata.po file in the same folder as the .pot file was exported (Kenshi\__translations\<locale>\)
      Image
    2. Open the Import/Export translation window (the same as in the exctraction part)
      Image
    3. Press "Import" button.
      Image
    Once this is done, all the translations will be loaded to the active translation mod. In the Translation Mode the base game data changes won't be visible since it only displays dialogue stuff.
    If you want to see the changes in the FCS, activate Translation Mode but before clicking on the Done button, hold Alt key and then click on the button. This will load the translation as a normal mod.

    Special note: If you used the previous system where it exported a dialogue folder and have translation of those, place the dialogues folder in the same location as the gamedata.po file and use the import function. This will add those translations to the translation mod. The translated strings that are the same as the base ones will show as non-translated in the editor.
  6. Packing:
    Once you finished translating or want to make a partial release, you'll need to save the changes in the FCS and place all the files in the corresponding folders.
    1. Create the final folder (output folder):
      1. If you are creating a normal translation, create a folder in Kenshi\locale\ with the name in the format specified in the Format/Folders section above.
        E.g.: Kenshi\locale\fr-FR\
      2. If you are creating a mod translation, create a folder named locale in your mod folder (e.g. Kenshi\mods\<mytranslationmod>) with a folder inside with the name in the format specified in the Format/Folders section above.
        E.g.: Kenshi\mods\<mytranslationmod>\locale\fr-FR\
    2. Copy the translation result files:
      • Copy the .translation file in the output folder (created in step 3.1). If you didn't extracted/built the files using the FCS tool, ignore this step.
      • Create a folder under the output folder (step 3.1) named LC_MESSAGES
      • Copy the translated main.mo file (note that is the .MO file, NOT the .po file) into the LC_MESSAGES folder.
    The output folder should look something like this:
    • Normal translation

      Code: Select all

      Kenshi
      \---locale
          \---ru
              |   ru.translation
              |   
              \---LC_MESSAGES
                      main.mo
          
    • Mod translation

      Code: Select all

      Kenshi
      \---mods
          \---my_russian_translation
              |   my_russian_translation.mod
              |           
              \---locale
                  \---ru
                      |   ru.translation
                      |   
                      \---LC_MESSAGES
                              main.mo
          
  7. Extra content
    Because the fonts shipped with the game (and maybe other content) doesn't support all languages, you'll probably need to modify or add new content to your mod/translation.
    Luckily both type (normal and mod translation) support modifying or adding extra game files easily:
    • For Mod translations, since it's works the same as a mod, you just need to create the folders on the mod folder using the same structure and placing the files you want to add or replace. (E.g.: Kenshi\mod\mymod\ ~= Kenshi\data\)
    • For Normal translations, the output folder will behave the same as the mod folder. (E.g.: Kenshi\locale\ru\ ~= Kenshi\data\)
    The easiest way of explaining this is with an example.
    In this case what I'm going to do is add extra fonts to support Russian alphabet.
    If you check the current fonts in the game (Kenshi/data/gui/fonts/), only one of them supports Cyrillic alphabet (Exo2), however, if you check kenshi_fonts.xml (this is the file that is loaded by the game and contains all the information of the fonts) for that font it only uses the character code range 32 to 126 which don't include the Cyrillic characters. To fix this we need to add those character ranges.
    • Before:

      Code: Select all

      <Code range="32 126"/>
      
    • After:

      Code: Select all

      <Code range="32 126"/>
      <Code range="1024 1279"/>
      
    Note: I don't know if that includes all the needed characters, for now let's assume it is enough.

    For the two other fonts used, we need to choose new ones (https://fonts.google.com/ is a good source of nice free fonts) and modify kenshi_fonts.xml to use those new fonts (and also add the character codes ranges).
    Once we finish with that, the last step is to copy them to the locale/mod output folder.

    The result will be something like this:
    • Normal translation

      Code: Select all

      Kenshi
      \---locale
          \---ru
              |   ru.translation
              |   tips.txt
              |   namesF.txt
              |   namesM.txt
              |   namesMF.txt
              |   
              +---gui
              |   \---fonts
              |           kenshi_fonts.xml
              |           pretty_font_with_cyrilic_chars.ttf
              |           some_font_with_cyrilic_chars.ttf
              |
              \---LC_MESSAGES
                      main.mo
          
    • Mod translation

      Code: Select all

      Kenshi
      \---mods
          \---russian
              |   russian.mod
              |   tips.txt
              |   namesF.txt
              |   namesM.txt
              |   namesMF.txt
              |
              +---gui
              |   \---fonts
              |           kenshi_fonts.xml
              |           pretty_font_with_cyrilic_chars.ttf
              |           some_font_with_cyrilic_chars.ttf
              |           
              \---locale
                  \---ru
                      |   ru.translation
                      |   
                      \---LC_MESSAGES
                              main.mo
          
    Note 1: I didn't include the Exo2 fonts since they are already in the game data folder.
    Note 2: I've included tips.txt, namesF.txt, etc. as an example of other files that can be modified.
  8. Share and profit?
    Upload it to Steam Workshop, to another site or do whatever you want with it.
General comments:
  • The locale folder with name 'en-GB' will be ignored since the game is already in English. You can still create a country variation for English. (I.e.: en-US, en-AU, etc.)
FAQs:
  • How can I make the FCS as portable as possible?
    You just need the following files:

    Code: Select all

    Kenshi
    |   CSteamworks.dll.dll (*)
    |   DialogConditionControl.dll
    |   forgotten construction set.exe
    |   NLog.dll
    |   PropertyGrid.dll
    |   steam_api.dll (*)
    |   Steamworks.NET.dll (*)
    |   
    +---data
    |       Dialogue.mod
    |       gamedata.base
    |       Newwworld.mod
    |       rebirth.mod
    |       
    \---__translations
        \---es_ES
               ...
    
    (*) Only needed for the Steam version.
    Note: The folder structure needs to be maintained.
Edits:
02/02/2017 - Added FAQ for making it portable
06/12/2016 - Dialogue translation update
  • Now the translations are made on the FCS directly. (This way is easier to get the context.)
  • This will run FCS in a special mode where you can see all the dialogue lines and word swaps and modify them seeing the original strings.
  • The export will only export base game data (i.e. non-dialogue stuff). The import function will import base and dialogue translations (for legacy translations).
  • Now the you will be able to add new line options for the dialogue lines for your language.
Last edited by Zodd on Thu Feb 02, 2017 2:30 pm, edited 5 times in total.

User avatar
Sol Lignum
Posts: 1085
Joined: Sun Sep 06, 2015 5:56 pm
Location: Mother Russia!
Contact:

Thu Aug 04, 2016 6:15 pm

This is brilliant! Thank you very much for your great work!

Zodd
Developer
Posts: 117
Joined: Thu Jul 28, 2016 11:33 am

Tue Dec 06, 2016 7:24 pm

I've updated the guide for the new translation changes.

User avatar
Sol Lignum
Posts: 1085
Joined: Sun Sep 06, 2015 5:56 pm
Location: Mother Russia!
Contact:

Thu Dec 08, 2016 8:37 am

Um... ok, dialogues are a -bit- easier to understand now, but this has brought several penalties. From what i can think of:

- It's now -way- harder to calculate wordcount for those who are making a translation for money. Before, one could've just add finished .po files into google translator toolkit which would show completion percentage and wordcount right away.

- It's now pretty much impossible to take the translation away from a PC where Kenshi and FCS are installed. These are much heavier then bunch of .pot files + Poedit.

So, hope you've had a good reason behing this change.

p.s.: Also, could you tell which base mods should be selected in the FCS, to get a full fetch of dialogues?

Zodd
Developer
Posts: 117
Joined: Thu Jul 28, 2016 11:33 am

Thu Dec 08, 2016 12:44 pm

Sol Lignum wrote:Um... ok, dialogues are a -bit- easier to understand now, but this has brought several penalties. From what i can think of:

- It's now -way- harder to calculate wordcount for those who are making a translation for money. Before, one could've just add finished .po files into google translator toolkit which would show completion percentage and wordcount right away.

- It's now pretty much impossible to take the translation away from a PC where Kenshi and FCS are installed. These are much heavier then bunch of .pot files + Poedit.

So, hope you've had a good reason behing this change.

p.s.: Also, could you tell which base mods should be selected in the FCS, to get a full fetch of dialogues?
The main reasons where simplicity and context.
Before it generated more than 900 pot files just for the dialog, and each of those with several lines. That made it difficult to know when a new dialog file appeared or was changed. You had to update each .po file manually just to check if the pot file was updated.
The other reason was context; since the dialog is a tree structure it made more sense to see it that way. Linearly (i.e. using pot files) was hard to figure out which line came before which. Also, know you can see properly the conditions to execute each line (race, gender, state, etc.) and referenced dialogues.
All of this helps to make a better and easier translation.

For the word count, I can see if we can add those stats directly to the FCS.

Regarding the portability, you just need the following files:

Code: Select all

Kenshi
|   forgotten construction set.exe
|   NLog.dll
|   PropertyGrid.dll
|   
+---data
|       Dialogue.mod
|       gamedata.base
|       Newwworld.mod
|       rebirth.mod
|       
\---__translations
    \---es_ES
           ...
Note: The folder structure needs to be maintained.

The main mods are the ones that are selected by default in the upper part of the mod selection window:
  • gamedata.base
  • Newwworld.mod
  • Dialogue.mod
  • rebirth.mod
Last edited by Zodd on Thu Dec 08, 2016 5:20 pm, edited 1 time in total.

ruthfahlt
Posts: 22
Joined: Wed Aug 17, 2016 3:30 pm

Thu Dec 08, 2016 4:21 pm

So, the FCS is updated now, and I tried to use Translation mode, but at the instance I checked the box "Translation mode", I'll get an error message.

This is the detailed error message.(sorry my environment generates Japanese message)

Code: Select all

Just-In-Time (JIT) デバッグを呼び出すための詳細については、
ダイアログ ボックスではなく、このメッセージの最後を参照してください。

************** 例外テキスト **************
System.NullReferenceException: オブジェクト参照がオブジェクト インスタンスに設定されていません。
   場所 forgotten_construction_set.TranslationManager.TranslationCulture.Equals(Object obj)
   場所 System.Array.IndexOf(Array array, Object value, Int32 startIndex, Int32 count)
   場所 System.Collections.ArrayList.IndexOf(Object value)
   場所 System.Collections.ArrayList.Remove(Object obj)
   場所 System.Windows.Forms.ComboBox.ObjectCollection.AddInternal(Object item)
   場所 System.Windows.Forms.ComboBox.ObjectCollection.AddRangeInternal(IList items)
   場所 System.Windows.Forms.ComboBox.ObjectCollection.AddRange(Object[] items)
   場所 forgotten_construction_set.InheritFiles.updateTranslationsList(Boolean refresh)
   場所 forgotten_construction_set.InheritFiles.cbTranslationMode_CheckedChanged(Object sender, EventArgs e)
   場所 System.Windows.Forms.CheckBox.OnCheckedChanged(EventArgs e)
   場所 System.Windows.Forms.CheckBox.set_CheckState(CheckState value)
   場所 System.Windows.Forms.CheckBox.OnClick(EventArgs e)
   場所 System.Windows.Forms.CheckBox.OnMouseUp(MouseEventArgs mevent)
   場所 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   場所 System.Windows.Forms.Control.WndProc(Message& m)
   場所 System.Windows.Forms.ButtonBase.WndProc(Message& m)
   場所 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   場所 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   場所 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** 読み込まれたアセンブリ **************
mscorlib
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
forgotten construction set
    アセンブリ バージョン:0.9.0.0
    Win32 バージョン:0.9.0.0
    コードベース:file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Kenshi/forgotten%20construction%20set.exe
----------------------------------------
System.Core
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
NLog
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.3.2698
    コードベース:file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Kenshi/NLog.DLL
----------------------------------------
System.Configuration
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Windows.Forms
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.ServiceModel
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel/v4.0_4.0.0.0__b77a5c561934e089/System.ServiceModel.dll
----------------------------------------
System.Data
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Runtime.Serialization
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
Steamworks.NET
    アセンブリ バージョン:9.0.0.0
    Win32 バージョン:9.0.0
    コードベース:file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Kenshi/Steamworks.NET.DLL
----------------------------------------
mscorlib.resources
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_ja_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
System.Windows.Forms.resources
    アセンブリ バージョン:4.0.0.0
    Win32 バージョン:4.6.1586.0 built by: NETFXREL2
    コードベース:file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_ja_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** JIT デバッグ **************
Just-In-Time (JIT) デバッグを有効にするには、このアプリケーション、
またはコンピューター (machine.config) の構成ファイルの jitDebugging 
値を system.windows.forms セクションで設定しなければなりません。
アプリケーションはまた、デバッグを有効にしてコンパイルされなければ
なりません。

例:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

JIT デバッグが有効なときは、このダイアログ ボックスで処理するよりも、
ハンドルされていない例外はすべてコンピューターに登録された
JIT デバッガーに設定されなければなりません。



Zodd
Developer
Posts: 117
Joined: Thu Jul 28, 2016 11:33 am

Thu Dec 08, 2016 4:29 pm

ruthfahlt wrote:So, the FCS is updated now, and I tried to use Translation mode, but at the instance I checked the box "Translation mode", I'll get an error message.

This is the detailed error message.(sorry my environment generates Japanese message)
This, if I'm not mistaken, has to do with a bug I've fixed and should be in the next update.
In the mean time, you need to clear the "__translation" folder. Just move the content to another folder and then, after creating adding the language in the FCS, copy the files you'll use: "gamedata.po" and "dialogue" folder to the new folder.

Zodd
Developer
Posts: 117
Joined: Thu Jul 28, 2016 11:33 am

Thu Dec 08, 2016 5:19 pm

Zodd wrote:
Sol Lignum wrote:Um... ok, dialogues are a -bit- easier to understand now, but this has brought several penalties. From what i can think of:

- It's now -way- harder to calculate wordcount for those who are making a translation for money. Before, one could've just add finished .po files into google translator toolkit which would show completion percentage and wordcount right away.

- It's now pretty much impossible to take the translation away from a PC where Kenshi and FCS are installed. These are much heavier then bunch of .pot files + Poedit.

So, hope you've had a good reason behing this change.

p.s.: Also, could you tell which base mods should be selected in the FCS, to get a full fetch of dialogues?
The main reasons where simplicity and context.
Before it generated more than 900 pot files just for the dialog, and each of those with several lines. That made it difficult to know when a new dialog file appeared or was changed. You had to update each .po file manually just to check if the pot file was updated.
The other reason was context; since the dialog is a tree structure it made more sense to see it that way. Linearly (i.e. using pot files) was hard to figure out which line came before which. Also, know you can see properly the conditions to execute each line (race, gender, state, etc.) and referenced dialogues.
All of this helps to make a better and easier translation.

For the word count, I can see if we can add those stats directly to the FCS.

Regarding the portability, you just need the following files:
Kenshi
| forgotten construction set.exe
| NLog.dll
| PropertyGrid.dll
|
+---data
| Dialogue.mod
| gamedata.base
| Newwworld.mod
| rebirth.mod
|
\---__translations
\---es_ES
...

The folder structure needs to be maintained.

The main mods are the ones that are selected by default in the upper part of the mod selection window:
  • gamedata.base
  • Newwworld.mod
  • Dialogue.mod
  • rebirth.mod
Ok, I've added showing stats and re-added the possibility of exporting pot files for dialogue if you don't want to use the FCS tool.
I'll update the guide later.

User avatar
Sol Lignum
Posts: 1085
Joined: Sun Sep 06, 2015 5:56 pm
Location: Mother Russia!
Contact:

Thu Dec 08, 2016 6:36 pm

Zodd wrote:Ok, I've added showing stats and re-added the possibility of exporting pot files for dialogue if you don't want to use the FCS tool. I'll update the guide later.
Oh, thank you greatly! Although i completely understood the reason behind the change after your explanation about updates. It makes whole lot of sense, actually, didn't figured it at first.

Many thanks for explaining everything as well, all clear now.

ruthfahlt
Posts: 22
Joined: Wed Aug 17, 2016 3:30 pm

Fri Dec 09, 2016 2:09 am

Zodd wrote:
ruthfahlt wrote:So, the FCS is updated now, and I tried to use Translation mode, but at the instance I checked the box "Translation mode", I'll get an error message.

This is the detailed error message.(sorry my environment generates Japanese message)
This, if I'm not mistaken, has to do with a bug I've fixed and should be in the next update.
In the mean time, you need to clear the "__translation" folder. Just move the content to another folder and then, after creating adding the language in the FCS, copy the files you'll use: "gamedata.po" and "dialogue" folder to the new folder.
This worked properly, thanks.

Galbar
Posts: 8
Joined: Mon Jan 07, 2019 1:19 am
Location: Paris, France

Mon Jan 07, 2019 12:31 pm

Hello,

Thank you for this guide, it's awesome helpful !

If I can suggest and maybe ask something :

Can we have a search tool like CTRL+F & a replacement tool CTRL+H functions in FCS ?

Because, with this, we will be abable to replace a word, a name, without check all lines.

In fact is the first thing I search, and if I'm not blind (it happens sometimes) I don't find this functions.

EDIT :
ANSWER from Developer "Someone" :
someone wrote:
Mon Jan 07, 2019 7:08 pm
There is a search function in FCS. Type 'text: something' into the box at the bottom of the dialogues list to find all dialogue containing 'something'. Opening a dialogue should then have the relevant line selected.
Thank you : I am blind... we have a CTRF+F Search function :)

But a real replacement tool will maybe useful ;)

Regards,
Galbar
Last edited by Galbar on Tue Jan 08, 2019 3:09 am, edited 6 times in total.

Galbar
Posts: 8
Joined: Mon Jan 07, 2019 1:19 am
Location: Paris, France

Mon Jan 07, 2019 3:14 pm

EDIT : after past all my day (in part) to test and try, I re-write this reply for a more flexible reading, sadly not shorter, sorry for that :
EDIT 2 : After answers of developpers (thaaaaaaaanks !) look EDITED PARTS

PS : I'm French so "excuse my english"

EDITED PART :
1) I start this after search for mod for better translation and better french UI, without see in changelogs there was french update translations from the 1.0.0 to 1.0.9, so I go like a bull :)

I am ready to work for free with the french translator and help. (contact me here and/or with my account mail) :

I just finished to control and correct the existing french (fr_FR) gamedata.PO, with Poedit.
I found many duplicate copy for many totally differents things -> DEV ANSWER : Poedit bug
I think my work is not perfect, but I work with research on wiki, with english and french dictionnaries to sometimes have the "archaics senses" of the words, I try to not distort the original view of the creators, translate easter egg or "punword's play" at better I can for french people, and maybe add some hided references in line with the game. So I could bring some new good ideas for exemple : hounds and blackshifters.
And I rapidly try to put comments when I modify somethings or when I find a potential error, in spirit that can be easier for another person to work with. We speak around 430 lines, commented/modified (10 or 20 more or less because I don't start right away the systematically comments).

2) My gamedata.po & gamedata.mo and my kenshi_fonts.xml for french translation are in attachment (include "fr_FR.translation" & "translated.txt").
fr_FR.zip
(2.75 MiB) Downloaded 3604 times
WARNING : in state there is inconsistencies between MY gamedata.po and the already french Dialogue part in FCS that I have not yet controled/modified, because some words are translated in other way or duplicate translated or not translated. There was already inconsistencies between both before my changes.

3) My reals problematics :

So I have my new translated french gamedata.PO & gamedata.MO.

EDITED PART :
3.1) gamedata.POT VS gamedata.PO = different line number & not the good account at final : WHERE IS THE THIRD LINE ?

I start with a different version of the actual game and maybe there was an update, an add.

So, I compare my gamedata.PO with the new gamedata.POT exported by FCS by simulating an all new fr_FR translation in Kenshi\__translations\ (and not kenshi\locale\...).
My .PO : 3285 lines
The new .POT : 3288 lines
3288 -3285 = 3 new lines in sources

In Poedit, with his dedicated function, I update my new translated french gamedata.PO with the new gamedata.POT.

I found only 2 new lines (or 2 untranslate lines) NOT 3, it mean without translation word, with empty translation part.

ANSWER FROM DEV : certainly a Poedit auto-translation,
YES ! : in Poedit File / Preferences... / Translation Memory -> uncheck "When updating from sources" to control what happens.
You even have the old Source Text written in the notes ;)

3.2) How to have an UPDATED "Dialogue & Word Swaps" parts in FCS, INCLUDING the already translate dialogues ?
Or : When I load my fr_FR in FCS, does it add automatically the potential new "Dialogue lines and Word Swpas lines" and so : Does
"fr_FR.translation" is automatically updated ?

SO : Now, it's time to control/corect the "Dialogue" part directly in FCS.

So I load the actual fr_FR with my new translated & updated french gamedata.PO and the already existing and provided "fr_FR.translation" file.
I IMPORT to apply changes, and it work : in "Dialogue" parts when I double click on a dialogue, I see my changes in the details part from gamedata.po. And I see the added "Word Swaps".

I would to be sure : if I have all the Dialogues lines and all the Word Swaps, directly, when I load my fr_FR ?

EDITED PART :
3.3) "what is" and why in the guide we can read about "LC_MESSAGES" directory and the "main.po" & "main.mo" files ?

This is what I totally missunderstood in the guide, maybe not clear maybe blind I'll check that :
SO : not really clear and blind too :
- Getting started: a.Introduction :
"Since the SC's strings are already shipped with the game (in the file 'main.pot' that is located in 'Kenshi\locale\en_GB\LC_MESSAGES'), you'll need to decide if you want to extract the game data strings or make a mod directly as commented above.
The decision is up to you."
- d. Translating: Translation notes:
"Also, all non-translated strings (empty string "") in the .po files will be show the original string in English (both from the main.po and the game data extracted/build from the FCS).
- f. Packing: 2. :
"Copy the translation result files:
Create a folder under the output folder (step 3.1) named LC_MESSAGES
Copy the translated main.mo file (note that is the .MO file, NOT the .po file) into the LC_MESSAGES folder."

That's all the "main.po/.pot" words in the guide, it's, for me, not clear enough it missing a sentence like "copy main.pot from locale\en_EN\LC_MESSAGES to your" or "copy the LC_MESSAGES directory from locale\en_EN to your xx_XX directory" and "start the translation of main.pot with Poedit and you will have in saving your main.po and your main.mo

LC_MESSAGES and main.pot/.po/.mo are not created by FCS in your new "Kenshi\__translations\xx_XX" directory you need to create them copying from the Kenshi\locale\en_EN\ ;)

AND other misunderstanding :
main.pot/.po/.mo are a third part of the translation system : the "interface" words, to translate in Poedit.
Not the gathering of all the old .pot dialogue system (who can always be exported by FCS).

4) Forgotten unicode needed in the French provided "kenshi_fonts.xml" :

PS : I used this link to find the "code range" needed for French in the unicode (if it's a bad version of unicode tell me !) :
https://unicode-table.com/

I've spotted some "word errors" in game in French, some words with "space" like for exemple "The eye" and "The Eye" who are translate in french by "L'œil" and "L'Œil" with the character "œ" and not the two characters "o" and "e", it appears in game like "L' ".
So I read in guide how to add characters fonts who are already include in Exo 2 font and others already present fonts in game by default, no need more in french contrary to the russian exemple.

I've found in the default "kenshi_fonts.xml" (so english "kenshi_fonts.xml") :
For all the first font places :
<Code range="32 126"/> (who is the regular english alphabet, without accents)
<Code range="8127 8217"/> (who is need for ??? We need to know if this characters fonts is needed for the game in general so for the others translations ???)
For only the last place font ("Kenshi_UI_Messages") :
<Code range="65 90"/> (who is the regular english alphabet, upper case without accents)
<Code range="46 46"/> (who is the "point" ".")


And I was expecting for french :
<Code range="32 126"/>
<Code range="8127 8217"/> (maybe, if it's for specific symbology, hence my questions above)
<Code range="192 255"/> (who is the actually included lower & upper cases with accents, including Æ and æ, needed in french)
<Code range="338 339"/> (who is the actually missing "Œ" and "œ", needed in french)

And placed potentially everywhere, so there's no forgetting.

I found in the French provided :
<Code range="32 255"/> (who is the actually included regular french alphabet without and with accents, for lower and upper cases and same the "Æ" and "æ" but not "Œ" and "œ")

Placed everywhere.


EDITED PART :
Ah ! Another things :

I post a topic in "Translation" about "How to update existing translation ?"
And it will be deleted when we update the guide and adding the clear missing informations.

I think it is missing in the guide :
- Maybe Start the guide by describe what is a complete new translation directory, very simply in few lines without screenshots, explaining the third parts : gamedata.pot : elements names / main.pot : interface words / dialogues
For me in re-reading the guide I understand there is 2 parts : gamedata and the dialogue in FCS, and I lost of view and missunderstanding the main.pot/.po/.mo part, but in reality there is 3 parts.
- Clearly add a part/sentence "copy the LC_MESSAGES\main.pot en_EN to your directory"

Regards,
Galbar
Last edited by Galbar on Fri Jan 11, 2019 2:16 am, edited 39 times in total.

someone
Developer
Posts: 360
Joined: Fri Aug 23, 2013 6:00 pm
Contact:

Mon Jan 07, 2019 7:08 pm

There is a search function in FCS. Type 'text: something' into the box at the bottom of the dialogues list to find all dialogue containing 'something'. Opening a dialogue should then have the relevant line selected.

The files in LC_MESSAGES are completely separate from the FCS. The pot file is located in locale/en_GB/LC_MESSAGES.
If you want to copy an existing translation, just copy those files.

Galbar
Posts: 8
Joined: Mon Jan 07, 2019 1:19 am
Location: Paris, France

Mon Jan 07, 2019 8:47 pm

someone wrote:
Mon Jan 07, 2019 7:08 pm
There is a search function in FCS. Type 'text: something' into the box at the bottom of the dialogues list to find all dialogue containing 'something'. Opening a dialogue should then have the relevant line selected.
Oh man I am blind ! Thank you pff saved !

Galbar
Posts: 8
Joined: Mon Jan 07, 2019 1:19 am
Location: Paris, France

Mon Jan 07, 2019 8:54 pm

someone wrote:
Mon Jan 07, 2019 7:08 pm
The files in LC_MESSAGES are completely separate from the FCS. The pot file is located in locale/en_GB/LC_MESSAGES.
If you want to copy an existing translation, just copy those files.
Ok thank you so much, so where does they come ??
There is 5 new lines in en_EN main.POT and fr_FR main.PO
EDIT : I re-write all my reply, above, please look it ;)

Regards,
Galbar

someone
Developer
Posts: 360
Joined: Fri Aug 23, 2013 6:00 pm
Contact:

Wed Jan 09, 2019 7:14 pm

I think your confusion comes from translations not all being in a single file.
The main.mo file in LC_MESSAGES contains translations for the interface. The lines are from the main.pot file I mentioned and is accessed directly by the game.
The gamedata.po file contains all the game items. You edit it in poedit and import it into the .translation file using the FCS.
Dialogue is edited directly in the FCS, which is also part of the .translation file.
Any new or updated dialogue will be detected in the FCS from the mod list when you opened the FCS.

The case of your missing line is likely from automatic translation as poedit does do that.

Galbar
Posts: 8
Joined: Mon Jan 07, 2019 1:19 am
Location: Paris, France

Thu Jan 10, 2019 9:59 pm

Hello,

Ah! maybe I understood new stuff :
"gamedata.po" for faction, item, character name and their descriptions = to update and translate by Poedit
"Dialogue & Word Swaps" who is the file "xx_XX.translation" for all the dialogues in game need = to translate in FCS directly.
and the new stuff I finally understood :
"main.po" for all the words who are in the interface (the launcher only or menu too ?) = to update and translate by Poedit and place it in our locale/xx_XX/LC_MESSAGES

1) I don't understood why when I start a new translation and when I export with FCS, I don't find any LC_MESSAGES with main.pot/.do/.do, in the Kenshi\__translation\xx_XX directory created... ??

To try to answer by myself : if I understand : we need to copy the main.pot who is in the locale/en_EN/LC_MESSAGES to first create, and use it after to update, our locale/xx_XX/LC_MESSAGES/main.po with Poedit and not FCS because actually FCS simply don't update it or don't export new main.pot/.po in our Kenshi\locale or Kenshi\__translations and do not propose to translate it directly.
FCS export only .POT who are models with obviously no possible translations added only sources, but if FCS can copy for us the gamedata.pot it could can the same for LC_MESSAGES\main.pot. I think a perfect and simple start for new translators would be appreciated by them ;)

2) And finally I would to know how to import already translated DIALOGUES in FCS making sure to have the new lines added ?
I MEAN : I wonder if when I load an existing translation, does new dialogues are automatically included in it ?
So load in the xx_XX.translation file ? And so I just need to find blue lines in Dialogue part in FCS to translate them and save ?

3) Does the file : "Translated.txt" is important ? Job ?

4) The case of my missing line :
YES ! : in Poedit File / Preferences... / Translation Memory -> uncheck "When updating from sources" to control what happens.
You even have the old Source Text written in the notes ;)

Thanks sooooo much Someone ;)

RayForward1
Posts: 2
Joined: Fri Jul 26, 2019 3:01 pm

Fri Jul 26, 2019 3:20 pm

Hi Zodd!
I'm a chinese translator.Thanks for your directing!But through the way in translate the whole game into Chinese i find a problem :(

It was
when we "Press "Import" button"
then we find the dialogue pot file could not correctly match every dialogue line we can see in FCS
For example .in recent game version we can see in FCS that the dialogue line "Intruder shek" has 14 dialogue line.
Image
But, the pot file "intruder shek.pot"we export out just has 13 dailogue line.It dosen't has the fist dialogue line——"Intruder!"
Image
And i also find if I click the button at The upper left corner"load" when i had load everything,again. than export ,the pot files won't as same as last time.maybe 12,or maybe 14,same as we can see in FCS
not just this pot file but also the other pot. :oops:
So what's the problem?Am I really not exporting the full pot file after pressing the button? What's going on here? :?:
Looking forward to your reply. Thank you very much!

someone
Developer
Posts: 360
Joined: Fri Aug 23, 2013 6:00 pm
Contact:

Wed Oct 16, 2019 3:01 pm

Any missing lines when exporting dialogue will be in other pot files. This happens to lines that are the same in multiple dialogues to avoid translating the same thing multiple times.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests