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 Pattern #230

Open
schanzer opened this issue Mar 19, 2019 · 2 comments
Open

Internationalization Pattern #230

schanzer opened this issue Mar 19, 2019 · 2 comments

Comments

@schanzer
Copy link
Member

schanzer commented Mar 19, 2019

From @prestontw : each parser could call out to a separate file for aria-labels, which contains an index of all the labels for all the node-types, indexed by human language.

So new Literal(l.from, l.to, v, {aria-label: `${v}, un Numero`}) would become something like:
new Literal(l.from, l.to, v, {aria-label: `${v}, ${labels.getLabelFor("number")["Spanish"]}`})

@justinpombrio
Copy link
Collaborator

Two thoughts on this:

  1. It's weird that this is done in the parser. I've put a function called .shortDescription() on ASTNode(). As is, it just looks up options["aria-label"]. But instead, the method could be .shortDescription(language), and everything that uses "aria-label" could instead call .shortDescription().
  2. We now have pluralization, enumeration, and support for multiple languages? It might be time to adopt an actual internationalization library.

@schanzer
Copy link
Member Author

schanzer commented Jun 3, 2019

In principle, ASTNodes should know how to describe themselves, since they're already responsible for rendering themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants