ReactiveDrop / reactivedrop_translations

Translations for Alien Swarm: Reactive Drop (2017), a mod of Valve's Alien Swarm (2010)
Creative Commons Zero v1.0 Universal
18 stars 49 forks source link

[idea] change format to gettext po files #791

Open mithrand0 opened 1 year ago

mithrand0 commented 1 year ago

An idea I am playing with is to change the translation format to Gettext, to support editing with Poedit, or WebLate.

Gettext is one of the-facto standards in the industry. Programs like Poedit make it easier for translators to translate, and also makes is possible for a lot of utilities to integrate with. We can generate Valve KV files from gettext files.

It's just an idea. I can make the arrangements if needed.

BenLubar commented 1 year ago

I'm looking at the gettext documentation and it doesn't seem like it supports any of the three(?) placeholder formats we use, %s1, %[1]s, and %first_value%.

The only other problem I can think of between converting back and forth is that gettext uses the source string as the key, so we'd have to figure out some way to handle multiple strings being able to have the same source with different notes.

We can't use gettext in the game because libgettext is GPL, but we can use it as an intermediary format.

BenLubar commented 1 year ago

looks like the latter problem is already common enough to have documentation: https://docs.weblate.org/en/latest/formats.html#mono-gettext

BenLubar commented 1 year ago

Just a quick inventory on the files we have:

// VDF TRANSLATION FILES
//
// achievements/563560_loc_{lang}.vdf (derived, not translated separately)
// addons/*/resource/closecaption_{lang}.txt
// addons/*/resource/reactivedrop_{lang}.txt
// community/inventory_service/inventory_service_tags_{lang}.vdf
// community/stats_website/statsweb_{lang}.vdf (uses Go format placeholders)
// community/steam_input/steam_input_{lang}.vdf
// platform/servers/serverbrowser_{lang}.txt
// platform/vgui_{lang}.txt
// resource/basemodui_{lang}.txt
// resource/chat_{lang}.txt
// resource/closecaption_{lang}.txt
// resource/gameui_{lang}.txt
// resource/reactivedrop_{lang}.txt
// resource/valve_{lang}.txt
// rich_presence/563560_loc_{lang}.vdf (partially derived - #official_* strings are not translated separately)
//
// VDF KEYVALUES (each value is translated)
//
// addons/*/resource/*_{lang}.txt (excluding closecaption and reactivedrop)
// addons/*/scripts/*_{lang}.txt
// credits/*_{lang}.txt
// resource/mail/*_{lang}.txt
// resource/news/*_{lang}.txt
//
// STEAMWORKS TRANSLATION JSON (simple key-value JSON; "language" matches filename, "appid" is 563560, remaining keys have translatable string values)
//
// community/points_shop/app_items_563560_{lang}.json
// community/workshop/workshop_tags_{lang}.json
// store_page/appname_563560_{lang}.json (optional)
// store_page/appname_582400_{lang}.json (optional)
// store_page/appname_593000_{lang}.json (optional)
//
// STEAMWORKS STORE TRANSLATION JSON (as above, but no "appid" key and there's an "itemid" key set to 81731)
//
// store_page/storepage_81731_{lang}.json
//
// TITLE+DESC SIMPLE TEXT (3+ line plain text file: first line title, second line blank, remaining lines description)
//
// community/eula/eula_{lang}.txt
// community/workshop/mappingcontest{year}_{lang}.txt
// community/workshop/workshop_description_{lang}.txt
//
// SIMPLE TEXT (entire file is one string)
//
// store_page/content_warning_563560_{lang}.txt
//
// STEAMWORKS EVENT TRANSLATION XML (xpath /content/string[@id])
//
// release_notes/archive/{yyyy}/{yyyymmdd}_{lang}.xml (low priority)
// release_notes/{yyyymmdd}_{lang}.xml
//
// STEAMWORKS ITEM SCHEMA WITH AS:RD EXTENSIONS (see https://github.com/ReactiveDrop/reactivedrop_translations/blob/master/utils/config.go inventoryKeyPrefixes)
//
// community/inventory_service/item-schema-*.json