EDDI
EDDI copied to clipboard
Internationalization - phase 2
Jotting down some of the items that we've discussed for future internationalization improvements
- [ ] Make scripts modular and translatable (as .resx files?)
- [ ] Add a button allowing users of localized scripts to compare to the invariant version? (proposed by Hoksilato in #1028) (Or just generally make it easier to translate new / changed scripts)
RESX files are complile-time, thus unsuitable for user-editing. I have a better storage format in mind that may help here, one that mimics the RESX fallback model but allows for user override.
Re Cottle I want:
- diff-friendly on disk -- no more Cottle encoded in JSON <= this is key
- Therefore each script resides in its own ".cottle" file, not JSON-encoded in an umbrella file because that sucks to edit and diff.
- Therefore we add a new key "script_path" that is a relative path to a *.cottle file and overrides any existing "script" key.
- This enables painless migration from the "script" key. to the "script_path" key.
So if a ".cottle" isn't found, it would revert to the default? Would the default also be a ".cottle", would it be more like a ".resx", or would we keep the defaults in the current ".json" format?
All these are open for discussion.
I am envisaging a per-script fallback chain exactly as for RESX, by script name, but allowing for user modification at run time. So the lookup chain might be:
- from tbe user-selected script of that name
- from the default script of that name for the user's localisation
- from the base lang script of that name
As discussed on Discord, we're considering a structure like this for a personality called foo:
foo/index.json -- the index file, resides in`%appdata%\EDDI\personalities
foo/de/ the German localisations
foo/
I would have a single index file foo/index.json
.
All scripts including en
would be under foo/{language-code}/{script-name}.cottle
.
foo/index.json
uses simply script-name
and the resolver tries foo/{language-code}/{script-name}.cottle
for the current language code, falling back to en
.
Thoughts welcomed.
The main disadvantage about having a single file per script is that a lot of them shares some code (as example: pluralization) which is'nt trivial to change for localization. Having ALL the scripts in the same file will help in finding/replace the same code with the localized one.
Why not using some ... special comment (like {_ §021§ _} ) at the beginning of each script as an index (similar to the way certain auto-document programs reads "///" comments in C files)?
About comparing the localized scripts with the "invariant" one, problem is the compare engine have to be VERY smart: right now adding a single line of comment makes it marking ALL the script as different; i can't think how it could check the same logic with different strings passed at the functions. A very Useful thing for this would be making each script with a strict separation between a logic section (where it do all the needed checks and sets) and the "spoken" section, where localization will make almost everything different.
Good points, noted. I'm going to say a hard no to the "special comment" idea though. Down that path lies madness.
Many languages need to factor out their pluralisation rules, so I am thinking more along the lines of a global "Grammar" script to house such functions.