Jump to content

Technical aspects


a333

Recommended Posts

So, you want to translate this game into your language.

I assume you understand the scale of this work. If not, then i'll recommend to read Safaquel's russian translation approach (Link), since this would greatly help you to work efficiently with the help of the community.

This topic is about technical aspects of the translation.

Data location

Most of the translatable text data located in the assets/strings.xml. Menu entries, interface elements, etc can be found here. As for now, some of the text is hardcoded, so you can't translate it yet, but it will change soon.

Xenopedia entries, respectively, are in the assets/xenopedia.xml.

You'll also want to check soldiernames.xml and soldiernamesfemale.xml.

Translating

You can use MS Excel for more comfortable editing, if you prefer it. Open Office is known to corrupt xmls, though.

XML files are encoded in UTF-8. That means you can just write there in your native language.

<Data ss:Type="String">Normal</Data> turning into<Data ss:Type="String">Нормальная</Data>

Be sure to save the file in UTF-8 because certain text editor tends to think it is smarter than you. Check the encoding in the save dialog and, even better, use notepad++ or akelpad.

Data strings also supports basic formatting. For example, translated string above is slightly longer than original, and sometimes it can lead to the rather unpleasant results.

&#1057;&#1085;&#1080;&#1084;&#1086;&#1082;.JPG

That's how to fix it:

<Data ss:Type="String"><font size='17' face='fonts/xenonauts.mvec'>Нормальная</font></Data> 

where < is a xml code for <, > is for >, so you basically got an xml inside of an xml:

<Data ss:Type="String">  <font size='17' face='fonts/xenonauts.mvec'>Нормальная</font></Data> 

Second level is likely to be processed by another parser, so it should be writed in codes. And the result is:

&#1057;&#1085;&#1080;&#1084;&#1086;&#1082;.JPG

That's better.

You can also use line breakers to start a new line.


Font basics

Playground SDK employ special outline font format called MVEC. Main game fonts are xenonauts.mvec, xenopedia.mvec and arial.mvec.

Xenopedia font contains ASCII (of course), almost all of the Controls and Latin-1 Supplement (advanced punctuation and basic diacritics), all Latin Extended A (advanced diacritics), Greek and Cyrillic sets.

Xenonauts font is slightly less universal, so it contains only basic punctuation, ASCII, Cyrillic, Greek and some of the Latin-1 supplement. This font is capitals only.

Arial font is used in tooltips, but not only there. When you'll try to insert some character that is missing in xenofonts, the game will resort to the arial.mvec, which i didn't check, but it's pretty stuffed. Result will be looking like this (image by Schnittertm):

&#1057;&#1085;&#1080;&#1084;&#1086;&#1082;.JPG

Note the Ü character (Also note that this character is now redrawed and included in the font). If you are okay with how it looks, then leave it as is. If not, then proceed to the next section.

What will happen if you try to write something like that?

<Data ss:Type="String">出口</Data>

You'll get nothing (in the best case) or even CTD. That's because this characters are missing even in the arial.mvec. And this bring us to the...

Font creation

If you are to add some new symbols in the font, you will need a converter.

Playmate Font Maker will do.

1. Install the font you want to convert in your system. TTF fonts only. Be sure not to violate any copyrights.

2. Run the tool. You will see the glyph sets available for the importing. There are basic sets for most of the languages, but you are free to modify/add your own. And probably you will have to do so. The sets are actually plain text files in a tool folder (UTF-8 encoded).

3. Select what you want to see. Don't forget numbers, some punctuation and ASCII English.

4. Tool will show if the font is missing something. If everything is ok, push the button and save the font somewhere.

5. Replace every font file in the assets/fonts/, or you can choose to replace only default (arial.mvec).

- Be sure to take into account UI stylistics. Xenonauts font must be heavier, while xenopedia should be readable even in small sizes.

- Arial.mvec is a bit tricky choice. Basically, you should be able to include everything in this one, as it is the default font for which game resorts in a case of a missing glyph. But exactly because of that this font should contain as much letters as possible. Use unicode font, add everything, act on your own risk. Also, everything will be quite monotonous.

Also, you may meet the repeating glyph problem when you are writing "АБВГ", but in the game it looks like "ААБГ" and so on. Fonts with languages which have some latin letters (like greek uppercase A,B,E,Ζ,etc) especially prone to this.

Solution:

The tool can't stomach glyph links. Glyph link is basically a shortcut to another glyph, and it doesnt contain any actual vector data. In good fonts all similar letters like Greek/Cyrillic A, B, etc, are linked to their corresponding english twins to save some bytes. Same goes for the complex letters like Ë, Î, Ñ.

So, that's what you do:

1. Download any font editor (Fontforge will do, and it's free).

2. Open your ttf.

3. Ctrl-A will select all the glyphs, then click the right mouse button on any, and chose "Unlink Reference". All links will be exchanged for a copied vector data.

4. File -> Generate Fonts, format: TrueType, No Bitmap Fonts, uncheck the validation (sometimes it causes CTD and will produce unneeded warnings). There you go. Now install the new ttf, be sure to select it in the Font Maker (if the font you installing was already present in system, you'll see the new font as fontname_0.ttf).

5. Convert and check. You're done.

Known issues and advices

(by Schnittertm)

- New Game, Load Game, overwrite save dialog buttons and Game Options are still hardcoded (though they have corresponding strings in xml);

- No string for 'Funds' in the subscreens;

- No string for 'Unassigned' in the Soldier and Vehicle subscreens;

- Apparent strings for 'Fuel level' and 'Paused - Press Space to resume' for Aircombatmode don't work, presumably hardcoded;

- Strings for soldiers nationality in the soldiersnames.xml files;

- Groundcombatmode Tooltip for Equipment tile only working when in the grenade selection screen of the tile;

- No tooltip on End turn button showing and End turn button seems to be a graphical element with no text string to adjust;

- '%'-character in text (with- or without ASCII code) making tooltips dislay only ####, as xml seems to expect a variable to refer to and not finding it. Workaround for now, write out percent instead of using the character itself.

Use double percent sign : %%

* All tooltips in Arial and case sensitive, most other strings printed in the Xenonauts font with only capital characters. This is a reminder to write case sensitive for tooltip entries, with other entries it does not matter as it will be rendered out in all capitals anyway.

&#1057;&#1085;&#1080;&#1084;&#1086;&#1082;.JPG

&#1057;&#1085;&#1080;&#1084;&#1086;&#1082;.JPG

&#1057;&#1085;&#1080;&#1084;&#1086;&#1082;.JPG

577e7caaa9bbc_105710851080108410861082.J

577e7caaacf53_105710851080108410861082.J

577e7caaaf5e8_105710851080108410861082.J

Edited by a333
Link to comment
Share on other sites

Excel is a proprietary software, therefore i can't test/recommend it. Open analogs can potentially break the xml or add garbage tags, so they need to be tested. But simple text editor is pretty robust option.

I'll add the Excel as more comfortable editor variant, if you are using it, though.

Link to comment
Share on other sites

  • 3 weeks later...

hello friends!

I am translating game into Polish language.

I've translated about 50% of strings.xml

Now i have problem with fonts. For example in menu (while in game press escape) i've got 'Zakończ grę', but it looks like 'Zakocz gr'. I've replacet arial font, but have no idea what font should i use for xenonauts.mvec and xenopedia.mvec. Do you have a ttf with this font? I can add Polish fonts to it by editing font itself, but it needs to be otf or ttf. for now i have found similar font with polish characters, but it is only for developement, right?

Thank you

ps. when I select save to overwrite in new confirmation window is hardcoded 'yes' and 'no' - it is not taken from strings.xml

Edited by duch
Link to comment
Share on other sites

  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...