lvgamedev / simairport-modding

4 stars 4 forks source link

i18n folders revamping (en/file1.xml en/file2.xml etc.) #85

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello,

Was wondering if this feature would be implemented as it would come useful in a lot of situations.

Example:

For example, im currently working on a large scale mod, i would like to split my files into separate English XML files.

My en.xml file is over 1000 lines long without separation.

If i separate my file i can get 4 250 lined .xml files.

Folder Path before:

i18n/en.xml

Folder Path after:

i18n/en/file1.xml - Starts with the <objects> node. i18n/en/file2.xml - Starts with the <objects> node. i18n/en/file3.xml - Starts with the <mp-ui> node. i18n/en/file4.xml - Starts with the <test> node.

In code they can be referenced like this:

I want to reference tree 1 name in file 2: objects.tree1.name - since 2 files have the same starting xml node. They are merged.

I want to reference the chat title in file 3: mp-up.chat.title - exact same as before.

To extend on this, maybe a i18n-settings.json where we can specify the optional settings:

    {
         "comment": "if addExtraStartNode is set to true, you can specify a name in extraStartNodeName, this makes it so you have to access i18n now like this: cal3432.objects.tree1.name",
         "addExtraStartNode": true,
         "extraStartNodeName": "cal3432",
         "comment2": "If noMerge is set to true, the files won't merge and you will have to access them by using file2.objects.tree1.name etc.",
         "noMerge": true,
         "comment3": "if singleFileMode is set to true (its true by default) the i18n stays normal like it is currently, en.xml de.xml etc. Its not in this file so it uses the language folder technique ",
         "singleFileMode": "false"
    }

I want to access tree1's name whilst this settings file exists: cal3432.file2.objects.tree1.name

See? Simple i guess.

I hope it is :)

ghost commented 4 years ago

Forgot one thing, a untranslatable.xml file, for symbols and special words such as the t800 exclumionator etc.

accessed by utd.firstNode.*

settings apply.

joscha999 commented 4 years ago

Implemented with next edge deploy.