Opened 10 years ago

Closed 10 years ago

#2487 closed enhancement (duplicate)

[PATCH] Gather mod informations and configuration

Reported by: Itms Owned by: Itms
Priority: Should Have Milestone: Alpha 17
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by Itms)

Based on my old #2118 patch, I propose this one, aimed at gathering mod data in a file at the root of the mod. The system should be general enough to suit every mod. Please give me feedback about it!

Attachments (3)

patch_moddata.patch (5.9 KB ) - added by Itms 10 years ago.
patch_moddata.2.patch (6.2 KB ) - added by Itms 10 years ago.
patch_moddata.3.patch (6.2 KB ) - added by Itms 10 years ago.

Download all attachments as: .zip

Change History (15)

by Itms, 10 years ago

Attachment: patch_moddata.patch added

comment:1 by Itms, 10 years ago

Milestone: BacklogAlpha 17

comment:2 by gallaecio, 10 years ago

In 15001:

Added support for message extraction from INI files

Refs #2487

comment:3 by Adrián Chaves, 10 years ago

Internationalization notes:

  • As we spoke on IRC, extract the font tags outside:
    sprintf(translate("[font=\"sans-bold-16\"]%(versionName)s: %(versionNickname)s[/font]\n\n")
    
    to
    "[font=\"sans-bold-16\"]" + sprintf(translate(%(versionName)s: %(versionNickname)s") + "[font=\"sans-bold-16\"]"
    
  • Add the following to the messages.json file to extract the keys of the INI file:
    {
        "extractor": "ini",
        "filemasks": [
            "config/public.cfg"
        ],
        "options": {
            "format": "none",
            "keywords": [
                "title",
                "version.name",
                "version.nickname",
                "version.number"
            ]
        }
    },
    
  • Translate those keywords in display strings. For example, change:
    {versionName: Engine.ConfigDB_GetValue("mod", "version.name"), versionNickname: Engine.ConfigDB_GetValue("mod", "version.nickname")} 
    
    to
    {versionName: translate(Engine.ConfigDB_GetValue("mod", "version.name")), versionNickname: translate(Engine.ConfigDB_GetValue("mod", "version.nickname"))} 
    

PS: I’m glad that we can get rid of those ugly keep/translate XML tags here.

comment:4 by Itms, 10 years ago

Description: modified (diff)

Updated the patch to use Gallaecio's improvements and cleaned up the organization of new files.

by Itms, 10 years ago

Attachment: patch_moddata.2.patch added

comment:5 by Radagast, 10 years ago

Cc: radagast@… added

comment:6 by Adrián Chaves, 10 years ago

getVersionLabel() is also missing translate() calls for its parameters.

Last edited 10 years ago by Adrián Chaves (previous) (diff)

comment:7 by Itms, 10 years ago

Indeed, sorry for the oversight :(

by Itms, 10 years ago

Attachment: patch_moddata.3.patch added

comment:8 by sanderd17, 10 years ago

What happens when multiple mods are loaded?

Is this still a valid ticket, or are there better approaches? I know you discussed with leper, but I didn't follow the discussions.

comment:9 by Radagast, 10 years ago

sander mentioned in another ticket that the same file in a mod can't be overriden more than once.

If multiple overwriting in a row worked then - when loading multiple mods - the last loaded mod that provides a info.cfg would get used for the ingame mod information in the main menu.

Last edited 10 years ago by Radagast (previous) (diff)

comment:10 by leper, 10 years ago

Overriding a file in different mods works just fine (it uses the file in the last mounted mod) (or the last mounted mod that has the file).

comment:11 by Itms, 10 years ago

Cc: radagast@… removed
Milestone: Alpha 17Alpha 18

Pushing this for leper's eyes only. The attached patch is in any case invalid due to r15676 et al.

comment:12 by leper, 10 years ago

Keywords: review removed
Milestone: Alpha 18Alpha 17
Resolution: duplicate
Status: newclosed

Most of what this ticket tried to solve is done using the mod.json files now. Everything that is left can be done by adding some files to a mod (version display). Having a mod specific config file might be useful at some point, but will probably give some issues with having two mods which both need some settings, and should be done in another ticket.

Note: See TracTickets for help on using tickets.