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

Localization #7

Open
bjarneo opened this issue Apr 18, 2017 · 3 comments
Open

Localization #7

bjarneo opened this issue Apr 18, 2017 · 3 comments

Comments

@bjarneo
Copy link

bjarneo commented Apr 18, 2017

Have you considered localization? My use case would be just to replace https://github.com/aweary/tinytime/blob/master/src/compiler.js#L29 and https://github.com/aweary/tinytime/blob/master/src/compiler.js#L44 with days/months in norwegian.

Basically just injecting two arrays to keep the code tiny.

@aweary
Copy link
Owner

aweary commented Apr 22, 2017

I haven't considered it, but I would be open to supporting it! We could maintain a set of localizations and create access points for each.

// imports tinytime with norwegian localiziations
import tinytime from 'tinytime/no'

Or if there's a package that already provides these localizations I'm happy to consider using it, or providing an API to integrate with it.

edit providing the API via import paths is actually not a great idea, since it makes dynamic localization trickier. I'm open to providing an API though!

@ulrikstrid
Copy link

Adding it as an option seems to be really easy if I'm not missing anything.

@mtimofiiv
Copy link

mtimofiiv commented Apr 24, 2017

@aweary do you mean then you would store localisations for each language in the one package? Wouldn't that bloat it a bit?

How about if you make a separate module for each that only has the localisation table in it? So for example you could do:

import tinytime from 'tinytime'
import tinytimeRULocale from 'tinytime-locale-ru'

tinytime.setLocale(tinytimeRULocale)

And then you're not having to maintain a package with localisation keys that make up more and more of the size of the module with each new language?

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

No branches or pull requests

4 participants