EDDI icon indicating copy to clipboard operation
EDDI copied to clipboard

Internationalization - phase 2

Open Tkael opened this issue 6 years ago • 10 comments

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)

Tkael avatar May 04 '18 18:05 Tkael

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.

richardbuckle avatar Nov 10 '19 22:11 richardbuckle

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.

richardbuckle avatar Nov 11 '19 01:11 richardbuckle

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?

Tkael avatar Nov 11 '19 01:11 Tkael

All these are open for discussion.

richardbuckle avatar Nov 11 '19 01:11 richardbuckle

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

richardbuckle avatar Nov 11 '19 01:11 richardbuckle

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//.cottle : the scripts

Tkael avatar Jun 18 '20 00:06 Tkael

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.

richardbuckle avatar Mar 10 '21 01:03 richardbuckle

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.

parduz avatar Apr 09 '21 22:04 parduz

Good points, noted. I'm going to say a hard no to the "special comment" idea though. Down that path lies madness.

richardbuckle avatar Apr 09 '21 23:04 richardbuckle

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.

richardbuckle avatar Apr 09 '21 23:04 richardbuckle