Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internationalization - phase 2 #523

Open
2 tasks
Tkael opened this issue May 4, 2018 · 10 comments
Open
2 tasks

Internationalization - phase 2 #523

Tkael opened this issue May 4, 2018 · 10 comments
Assignees
Labels
9. enhancement The behaviour is as specified, but we would like to modify or extend the spec. significant work Just sayin'

Comments

@Tkael
Copy link
Member

Tkael commented May 4, 2018

Jotting down some of the items that we've discussed for future internationalization improvements

@Tkael Tkael added the 9. enhancement The behaviour is as specified, but we would like to modify or extend the spec. label May 4, 2018
@richardbuckle richardbuckle added the needs thought For when you need to slow down and consider things. label Jun 28, 2018
@richardbuckle
Copy link
Member

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
Copy link
Member

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.

@Tkael
Copy link
Member Author

Tkael commented Nov 11, 2019

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?

@richardbuckle
Copy link
Member

All these are open for discussion.

@richardbuckle
Copy link
Member

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

@Tkael
Copy link
Member Author

Tkael commented Jun 18, 2020

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 Tkael removed the needs thought For when you need to slow down and consider things. label Feb 22, 2021
@richardbuckle
Copy link
Member

richardbuckle commented Mar 10, 2021

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.

@parduz
Copy link

parduz commented Apr 9, 2021

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.

@richardbuckle
Copy link
Member

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

@richardbuckle
Copy link
Member

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.

@Tkael Tkael added the significant work Just sayin' label Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
9. enhancement The behaviour is as specified, but we would like to modify or extend the spec. significant work Just sayin'
Projects
None yet
Development

No branches or pull requests

3 participants