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

Feature Request: Support Maketext strings #85

Open
konobi opened this issue Dec 11, 2015 · 5 comments
Open

Feature Request: Support Maketext strings #85

konobi opened this issue Dec 11, 2015 · 5 comments

Comments

@konobi
Copy link

konobi commented Dec 11, 2015

Maketext has a more powerful format, that allows for more precise translation. For example: International Date Formatting.

http://search.cpan.org/~toddr/Locale-Maketext-1.26/lib/Locale/Maketext.pod

More info about the Maketext format makes sense for linguistics:

http://search.cpan.org/~toddr/Locale-Maketext-1.26/lib/Locale/Maketext/TPJ13.pod

@gjuchault
Copy link
Collaborator

I'm not sure how you'd like to see that in i18n-node-2.

@konobi
Copy link
Author

konobi commented Jan 5, 2016

So take the following string:

"Your search matched [quant,_1,document]!"

the square brackets become a routine. On the object that represents the "language", there's a "quant" function that is used with the values passed in and in turn in spits out the proper string. But for example, if the current language is changed to japanese, I'll need a quant function that is specific to japanese. Since the function just hangs off of the "object", I can have a different quant function only for japanese, or for whatever language is wanted.

A good example is things like date or currency formatting, which can be wildly different based on locale.

@gjuchault
Copy link
Collaborator

I do prefer the idea of a function (#78) that could handle the parameters than trying to make a maketext parser on a string

@konobi
Copy link
Author

konobi commented Jan 5, 2016

Well, the nice thing is that you can pre-compile all of the strings as functions and then use the string as a lookup key. And the ability to have any function (not just quant, etc.) makes it more attractive. If you read the second link above (TPJ13), you'll see how this maps better to i18n as a whole. Since it's just matching braces, there's plenty of parsers already available to handle that.

@gjuchault
Copy link
Collaborator

I'll wait for @jeresig opinion on that

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