Localizing DW2 for non-Latin character sets

Please post here for questions and discussion about data, event, art and sound modding and the game editor for Distant Worlds.

Moderator: MOD_DW2

Post Reply
User avatar
elliotg
Posts: 3930
Joined: Mon Sep 10, 2007 9:32 am

Localizing DW2 for non-Latin character sets

Post by elliotg »

Hi all

This is a heads-up explaining a new feature coming in the next version of DW2 that will provide better support for languages with non-Latin alphabets.

Unfortunately the window for releasing public beta updates has closed for this year, so this update won't be available until January (version 1.2.8.0).

But this information might help anyone who is considering how to include a custom font that supports other character sets.

See the attached document for an outline of the general process. In summary you need to perform the following steps:
  1. translate all of the text in the various XML and text files (as with any Latin language)
  2. create a Stride bundle with a font that supports your character set
  3. switch the font bundle used in the game to your new custom font bundle
Currently step 3 (load the custom font bundle) requires modding using Harmony. The Chinese localization mod does this.

However from version 1.2.8.0 onwards there will be a new command line argument that allows loading a custom font bundle. No code modding is required for this, just add the command line argument. This is outlined in the attached document on pages 9 and 10.

In the meantime the first portion of the document may be helpful for anyone wondering how to make a Stride bundle containing the custom font.

Feel free to ask any questions.

Thanks
Elliot
User avatar
rxnnxs
Posts: 618
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

Re: Localizing DW2 for non-Latin character sets

Post by rxnnxs »

Thank you for this help.

I will try using a monospace font so the numbers appear in lists above each other in a better comparable line.

Could you short explain why harmony has to be used?
How can we use this harmony?

Why can't we use a mod to implement this and other bundles?
And can we use for instance this way then to change other data like sounds?

If I want to change a sound like an ui-click, could I do it this way then with a bundle like you described and use it in a mod that adresses this bundle?
User avatar
elliotg
Posts: 3930
Joined: Mon Sep 10, 2007 9:32 am

Re: Localizing DW2 for non-Latin character sets

Post by elliotg »

rxnnxs wrote: Sun Dec 15, 2024 9:35 am Could you short explain why harmony has to be used?
How can we use this harmony?
The default font is loaded as part of the core game content inside the bundles named CoreContent. To override the default font you need to load from a different bundle. Previously this required Harmony, which modified the font loading method in the game. This is how the Chinese localization mod loads it's own font.

With the new command line argument in 1.2.8.0 you don't have to use Harmony to load a different font. So it's now much easier. You just specify the bundle name as part of the command line argument.
Why can't we use a mod to implement this and other bundles?
And can we use for instance this way then to change other data like sounds?
You certainly can do this if you want. As mentioned above, the Chinese localization mod uses Harmony to change the font loading method.

But now you are no longer required to use Harmony if all you want to do is load a custom font.

Changing the sound effects is a good example. You could use Harmony to load a custom bundle with different sound effects and tweak the load path for these.
If I want to change a sound like an ui-click, could I do it this way then with a bundle like you described and use it in a mod that adresses this bundle?
Yes, see the Chinese localization mod here for an example:
https://github.com/szszss/DW2ChsPatch/b ... ntPatch.cs

The above class shows how the font loading method is changed to load the Chinese font.

You could do something similar with sound effects. Note that not all methods are accessible from Harmony though.
User avatar
elliotg
Posts: 3930
Joined: Mon Sep 10, 2007 9:32 am

Re: Localizing DW2 for non-Latin character sets

Post by elliotg »

If there's enough interest we could add a mechanism to load any desired bundles, perhaps specifying them in a text file or similar.

Then you could reference any new asset by path in the XML data files. Or just use this bundle-loading to override the default game assets (e.g. sound effects) with the same paths.
User avatar
rxnnxs
Posts: 618
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

Re: Localizing DW2 for non-Latin character sets

Post by rxnnxs »

By what I have read over the years here in the forum, the interest on thise implementation is huge.
If you could enable this bundle implementation for sounds and ui and so on, the modifications would be much easier to implement.

The learning curve would be now very shallow - compared to the link you supplied above. I looked into it and while I am learned in modding much games and learned to write some programs in c++ and many others, I have a very hard time to understand what code is needed to achieve a simple implementation.
So using harmony means in my eyes that we have to be programmers.
I am just a spare time modder.
Right now i am trying to learn python so I can program a Qt-Interface so I can play the newest Betas with my ShipSize/Orbits/Weaponsize Mod. This is as deep as I can go now..
And still then there is the problem for instance in the Orbittype.xml that if we want to change the translation and the size of the orbits, we have a problem because those Parameters are so "close" together, that if one mod changes the name and another changes a value, we have to bring the somehow together.. again.
Back to topic:

Now I managed to install and get stride running (inclusive the visual c components) so i got a bundle as an output.
And I read many times the how-to about implementing a new shiphull.
I do not have maya and besides that, I did not understand how to change the name to generate a bundle that has the name as needed in the tutorial.

Now, with your explanation in the first post (the pdf), I understand how to rename the project in stride.
And if then my bundle can be implemented with an easy method like a mod, and please with a little real text (like you gave us in the pdf regarding fonts), there is a way for us to explain that to the whole community.

So this would really be a huge step forward.

As you said, thsi implementation is coming next year, and in this time, we might get here some other helpful comments that show you how big that interest is in this new ability to include bundles
User avatar
rxnnxs
Posts: 618
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

Re: Localizing DW2 for non-Latin character sets

Post by rxnnxs »

When I edit the file Mono.Windows.sdpkg
to this:
code.jpg
code.jpg (15.82 KiB) Viewed 948 times
I get the error Message:
error.jpg
error.jpg (58.05 KiB) Viewed 952 times
I cannot even scoll up this Message Window. It freezes.

I am using the latest Version:
mono.jpg
mono.jpg (17.1 KiB) Viewed 952 times
When I am not changing the Bundles[] line,
I can do all what you have written.
User avatar
elliotg
Posts: 3930
Joined: Mon Sep 10, 2007 9:32 am

Re: Localizing DW2 for non-Latin character sets

Post by elliotg »

rxnnxs wrote: Sun Dec 15, 2024 9:10 pm When I edit the file Mono.Windows.sdpkg
to this:
code.jpg

I get the error Message:
Can you please attach your project package file here?

Thanks
Elliot
User avatar
rxnnxs
Posts: 618
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

Re: Localizing DW2 for non-Latin character sets

Post by rxnnxs »

Yes, here it is.

I made two small Testprojects.
The one I upload here is just started from scratch.
Mono.7z
(2.77 MiB) Downloaded 13 times
If you load under Dir Mono.Windows the file "Mono.Windows.sdpkg"
it works.
If you load the one (that you have rename first) "Mono.Windows-Bundlename.sdpkg", it is not working.

I have done before one Project that already has all Fonts included... Therefore it is too big. Packed it is ~20MB.
And there the Bundle is not changed. Work for nothing I think. This is how it happens all the time to me.
One step forward, two steps back. I stand up when I fail and try it again. But I just take my time between the next try. Otherwise impossible to stay cool :-)

-----------------------
Project splitted with Fonts already included
howToRename.jpg
howToRename.jpg (9.85 KiB) Viewed 929 times
MonospaceFont.001.7z
(10 MiB) Downloaded 7 times
MonospaceFont.002.7z
(9.87 MiB) Downloaded 9 times
alnigor
Posts: 4
Joined: Sun May 12, 2019 4:26 pm

Re: Localizing DW2 for non-Latin character sets

Post by alnigor »

I had the same error when I tried to make localization based on the Chinese patch and according to the instructions of its creators. After making changes in sdpkg it is no longer loaded in the editor and a similar error appears in the window that cannot be scrolled. At that time I did everything according to the guide from this post - https://www.matrixgames.com/forums/view ... 9&t=400864.
User avatar
rxnnxs
Posts: 618
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

Re: Localizing DW2 for non-Latin character sets

Post by rxnnxs »

Well well, I asked in the Stride Discord Channel if they can help.

With this Video I try to explain what is happening:
Video
User avatar
elliotg
Posts: 3930
Joined: Mon Sep 10, 2007 9:32 am

Re: Localizing DW2 for non-Latin character sets

Post by elliotg »

rxnnxs wrote: Mon Dec 16, 2024 6:46 pm Yes, here it is.

I made two small Testprojects.
The one I upload here is just started from scratch.
Mono.7z

If you load under Dir Mono.Windows the file "Mono.Windows.sdpkg"
it works.
If you load the one (that you have rename first) "Mono.Windows-Bundlename.sdpkg", it is not working.

I have done before one Project that already has all Fonts included... Therefore it is too big. Packed it is ~20MB.
And there the Bundle is not changed. Work for nothing I think. This is how it happens all the time to me.
One step forward, two steps back. I stand up when I fail and try it again. But I just take my time between the next try. Otherwise impossible to stay cool :-)

-----------------------
Project splitted with Fonts already included
howToRename.jpg

MonospaceFont.001.7z
MonospaceFont.002.7z
Sorry, I've just had a chance to look at this now.

Seems like YAML does not like the white space in that section of your sdpkg file.

I removed the tabs and replaced with spaces and all seems to work fine.

Check this YAML tutorial, especially this section on indenting:
https://www.cloudbees.com/blog/yaml-tut ... whitespace

Attached is the fixed file.

Thanks
Elliot
Mono.Windows.sdpkg.zip
(376 Bytes) Downloaded 10 times
User avatar
rxnnxs
Posts: 618
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

Re: Localizing DW2 for non-Latin character sets

Post by rxnnxs »

Thank you, great news!
So this is the Problem as you said: I used Tabulator instead of white spaces..
YAML, Python, whitespaces/indents are part of the language.. I did not know that stride is using directly this file.
tabswrong.jpg
tabswrong.jpg (25.33 KiB) Viewed 856 times
From your link:
YAML-Tuto wrote:Whitespace is part of YAML's formatting. Unless otherwise indicated, newlines indicate the end of a field. You structure a YAML document with indentation. The indentation level can be one or more spaces. The specification forbids tabs because tools treat them differently. Consider this document. The items inside are indented with two spaces.
Thanks again!
Post Reply

Return to “Design and Modding”