TR1X icon indicating copy to clipboard operation
TR1X copied to clipboard

In-game string translations

Open carlo-bramini opened this issue 2 years ago • 11 comments

I'm wondering what you may think about making a way to allow a better support for translations. At the time of writing, the needed strings are provided into the .json5 files, but it seems to me that it would be worth to move them outside, into a dedicated file. Actually, translating the game in a different language is already possible, but this will make lot of duplicated data about the levels and the game flows, which have nothing to do with that. This is already visible by comparing the content of the two .json5 files for the full game and Gold levels. If you think that exists also the demo version of the game, which is the one I usually use for debugging (at #667), the duplicated information will grow again.

What do you think about this?

carlo-bramini avatar Jan 22 '23 00:01 carlo-bramini

Ya it could probably be handled better to more easily support translations like the config tool does. We don't an issue for reworking the JSON files. But there's some issues such as #386, #626, and #466 related to this that might need to be done first to support this properly.

walkawayy avatar Jan 22 '23 17:01 walkawayy

the issue here is that the strings are directly tied to the gameflow. While you are saying "we only play normal data and the strings for that won't change". If one makes a fully custom game with all new levels etc. Then the "standard" strings won't match any more and it will need a custom translation file that then links to their new custom gameflow. Having a field for Strings in the gameflow, that people can edit may be a compromise, but this is a lot harder for people to understand and get right as filenames case sensitivity etc might eventually show up. Also installing it in some package form in say RetroPie or SteamDeck etc means direct edit the file is hard for people to add but select the file to load is easier.

oziphantom avatar Jan 23 '23 06:01 oziphantom

the issue here is that the strings are directly tied to the gameflow. While you are saying "we only play normal data and the strings for that won't change". If one makes a fully custom game with all new levels etc. Then the "standard" strings won't match any more and it will need a custom translation file that then links to their new custom gameflow. Having a field for Strings in the gameflow, that people can edit may be a compromise, but this is a lot harder for people to understand and get right as filenames case sensitivity etc might eventually show up. Also installing it in some package form in say RetroPie or SteamDeck etc means direct edit the file is hard for people to add but select the file to load is easier.

I think the idea would be to do something like the config tool's language files? Or maybe I'm misunderstanding. Yes custom games may then have default strings instead of the custom ones if the player switches to a language the creator didn't translate for. But the custom creator could set the default language for their game, and it's on the player at that point. I think supporting multiple translations of TR1 could be nice. But all this would still require duplicate files for TR1, Gold, custom levels, etc, in a language folder, so I might be missing the original issue's goal?

walkawayy avatar Jan 23 '23 15:01 walkawayy

Well, my idea for improving support for languages was something like that: (1) Move the strings into a separate file .json5 file. There will be a file for each language/sublanguage pair: for example, en-US.json5 for the english spoken in America. (2) Into the Tomb1Main_gameflow.json5 and others, there will be a key with the name of the language file, which could be "en-US" for example. If the key is missing, the strings will be read from the same .json5 file, like it is working now. At the end, there are two pointers to the content of .json5 data, in one case they will point to two different files, otherwise they will point to the same object. It won't change too much the code of the engine actually, in my opinion. (3) Instead of a key into the .json5 file, it could be also a parameter on the command line, if you want. Here, the most preferred solution can be choosen.

However:

If one makes a fully custom game with all new levels etc. Then the "standard" strings won't match any more and it will need a custom translation file that then links to their new custom gameflow.

It is not clear to me how this is expected to happen since the name of the .json5 files and the identifiers of the strings are both hardcoded into the C code of the engine.

carlo-bramini avatar Jan 24 '23 09:01 carlo-bramini

The script generate_init creates the init.c file which contains all the default strings in case there's any issues with the strings in the gameflow .json5 files. The gameflow .json5 files allow for custom strings already. But obviously there is currently only one gameflow for TR1 and TR1 Gold in the user's directory, so currently any translations would overwrite the English strings. Hence my point about having a way to set the language which loads the corresponding gameflow .json5.

I think the current system can work with an added language setting. The language parameter would determine which gameflow .json5 to load (English, Spanish, French, etc) and then it could still load the string based on a key like it is now.

Example: English Tomb1Main_gameflow.json5 "HEADING_INVENTORY": "INVENTORY",

Spanish Tomb1Main_gameflow.json5 "HEADING_INVENTORY": "INVENTARIO",

walkawayy avatar Jan 24 '23 19:01 walkawayy

Any update here? I like to see it germanized 😀

StenApp avatar Jan 21 '24 21:01 StenApp

Italian menu texts: https://archive.org/download/tomb-raider-ita/Testi.7z

Kappa971 avatar Mar 17 '24 11:03 Kappa971

It would be useful if something was done about this, so that it is not necessary to readjust the translation with each new version of TR1X 😅.

Anyway I updated the .json5 files for TR1X v4.0.1, the link is the same as above.

Kappa971 avatar Apr 10 '24 16:04 Kappa971

@lahm86 I'm kinda confused because #1285 should allow for easier translations in the future right? But the strings were deleted then brought back to the gameflow. I know we don't support official translations (yet), but now the strings are in 3 places again?

walkawayy avatar Apr 10 '24 16:04 walkawayy

@lahm86 I'm kinda confused because #1285 should allow for easier translations in the future right? But the strings were deleted then brought back to the gameflow. I know we don't support official translations (yet), but now the strings are in 3 places again?

update_gameflow updates the strings as necessary on commit, so they're still only defined in one place since #1285. It just means that the shipped gameflow files contain everything to allow easy modifications i.e. without knowing to lookup game/game_string.def to know key names to use.

lahm86 avatar Apr 10 '24 18:04 lahm86

I hope it switches to Priority: medium, I would like to be able to definitively upload at least the translation of the game menu into the repository, even without UTF-8 support (I can write à as a' etc, until there is support for special characters).

Subtitles are also important (maybe much more) but at least we would start from something.

Some idea: Move this section to a <language>.json5\dat\lng\or-whatever-else file, for example to the data\translation folder. Unique file for main game and expansion (no duplicate strings like now).

"strings": {
        "HEADING_INVENTORY": "INVENTARIO",
        "HEADING_GAME_OVER": "GAME OVER",
        "HEADING_OPTION": "OPZIONI",
        "HEADING_ITEMS": "OGGETTI",
        "PASSPORT_SELECT_LEVEL": "Seleziona Livello",
        "PASSPORT_RESTART_LEVEL": "Ricomincia Livello",
        "PASSPORT_STORY_SO_FAR": "Un po' di storia...",
        "PASSPORT_LEGACY_SELECT_LEVEL_1": "I salvataggi legacy non",
        "PASSPORT_LEGACY_SELECT_LEVEL_2": "supportano questa funzionalita'.",
        "PASSPORT_SELECT_MODE": "Scegli Modalita'",
        "PASSPORT_MODE_NEW_GAME": "Nuova Partita",
        "PASSPORT_MODE_NEW_GAME_PLUS": "Nuova Partita+",

        ...

},

The script file will call the strings from the language file:

<language>.json5

"strings": {

      ...

      "CITY_OF_VILCABAMBA": "Citta' di Vilcabamba",
      "SILVER_KEY": "Chiave d'Argento",
      "GOLDEN_IDOL": "Idolo d'Oro",

      ...

 },

TR1X_gameflow.json5

// Level 2
        {
            "title": "CITY_OF_VILCABAMBA",
            "file": "data/level2.phd",
            "type": "normal",
            "music": 57,
            "injections": [
                "data/injections/vilcabamba_itemrots.bin",
                "data/injections/vilcabamba_textures.bin",
            ],
            "sequence": [
                {"type": "loading_screen", "picture_path": "data/images/peru.webp", "display_time": 5},
                {"type": "start_game"},
                {"type": "loop_game"},
                {"type": "stop_game"},
                {"type": "level_stats", "level_id": 2},
                {"type": "exit_to_level", "level_id": 3},
            ],
            "strings": {
                "key1": "SILVER_KEY",
                "puzzle1": "GOLDEN_IDOL"
            },
            "demo": true,
        },

Kappa971 avatar Apr 28 '24 21:04 Kappa971