Add a command line interface.#3
Conversation
|
I'll play around with this. I want to also build some bindings to add the lib to the major templating languages that are precompilable. This helps for the most generic case, as well. I'm at JSConf right now, but I'll dive deeper within a few days. I'm definitely interested in getting this right. |
…mat implementation in the output
|
How lucky you are !!! I would love to be at the JSConf right now. I have a lot of ideas about new features in the CLI.
I did this because I don't use RequireJs anymore and I miss the i18n plugin. Now I am quite happy because messageformat.js looks far better than the i18n plugin. In my search for a RequireJs alternative, I am helping the universal-jst project that precompile the major templating languages in the JST format. So if we add some bindings to the templating engines, I will just be too happy to include it in universal-jst Cheers |
There was a problem hiding this comment.
Should we create a bin and allow it to be installed globally? Seems potentially useful.
|
Cool. I did a code-read and everything seems legit. I definitely want to do template integrations, and I potentially want a different or multiple ways to store the data (like all langs in one file, or langs in separate files). @Stuk and I are discussing whether we think it'd be a good idea to do some sort of 'contexts' like in gettext. I know it would be helpful in my projects. I don't think that should change a whole lot on this front though. Awesome work. What's next? Do you want to work on it more (you mentioned wanting to add things), or should we pull it in now and go from there? |
|
There are some issues for Windows (you can take a look at the recent universal jst commits in my repo), I will fix it this week. About watchr, it is the only lib I found that do recursive folder watching right but it force us to add coffee script in our deps :-/ Sure it's important that user could use the cli with a global install. Take the code, it's ours, change it as you want, I will do pull requests if I add new features. |
|
Everything is ok for me now. But for the future, I have several questions ... How to handle multiple locales ?
How to handle not translated keys in one lang ? Use a fallback lang, print a warning, ... And how to export the compiled messageformat when several lang are detected? one file, several files, ... How to handle comments and multilines?
|
|
Any chance we can get some docs on this? I'd feel pretty comfortable getting this in |
|
Just happy to do it :) |
|
@Filirom1 I like the way that this CLI tool is going! How do you plan on handling failover messages (defaults...)? |
|
Curently it is not handled. If you have an idea how to do it, please tell me. I am wondering about this (#3 (comment)). So all your suggestions are more than welcome. |
|
Gonna go ahead an pull this in. |
Add a command line interface.
Make the parser conform to ICU MessageFormat
Hi,
What do you think of the idea of a CLI tool for messageFormat.
I made one that iterates recursively in a folder and compile each json found.
I commited the exemple : https://github.com/Filirom1/messageformat.js/tree/master/example
And the CLI sources, you can take a look at the options: https://github.com/Filirom1/messageformat.js/blob/master/bin/messageformat.js.
This is a one evening hack, forked from https://github.com/Filirom1/universal-jst, but if you like the idea, I could do something better.
Cheers
Romain