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

Add option to provide a template #3

Open
LaurentGoderre opened this issue Oct 29, 2013 · 7 comments
Open

Add option to provide a template #3

LaurentGoderre opened this issue Oct 29, 2013 · 7 comments

Comments

@LaurentGoderre
Copy link
Contributor

For one our our use-case we need to replace only some of the strings and place them in a template. Is this something you would be open too?

/cc @nschonni

@theoephraim
Copy link
Owner

Sorry I don't follow. Do you mean you'd like it to do some find/replace in
template files?

@nschonni
Copy link

You can check out our current task here https://github.com/wet-boew/wet-boew/blob/v4.0/tasks/i18n.js

@theoephraim
Copy link
Owner

Its a bit hard to follow your example without knowing the format of the spreadsheet and desired file output.

Since using locale files with a i18n plugin is quite common with express and all the templating languages, I think it makes sense to keep this as is, just spitting out the locale files to be ingested by something else.

I would recommend still using a custom task, but using https://github.com/theoephraim/node-google-spreadsheets to handle the spreadsheet connection. You can also take a look at https://github.com/theoephraim/grunt-i18n-gspreadsheet/blob/master/tasks/i18n_gspreadsheet.js to see how this package uses it.
Or you could use this plugin to generate the locale files and use those directly (its just a json file with a dictionary of translations).

@nschonni
Copy link

Its a bit hard to follow your example without knowing the format of the spreadsheet and desired file output.

Whoops, https://github.com/wet-boew/wet-boew/blob/v4.0/src/i18n/i18n.csv, which is actually just a local copy (right now) of a google sheet, and https://github.com/wet-boew/wet-boew/blob/v4.0/src/i18n/base.js is the template that is filled out for each language.

@nschonni
Copy link

I'll have to look at your code closer because I was thinking that a direct JSON conversion would probably be better

@theoephraim
Copy link
Owner

It looks to me like you're overcomplicating things a bit.
You can generate the json you need directly from the spreadsheet without having to keep so many pieces in sync.

If you absolutely need those nested elements in your JSON output, you'll could do some post processing on the JSON file - or maybe we can figure out a key structure within the spreadsheet that could work, although currently the keys are totally flexible and I'd like to keep it that way if possible.

@LaurentGoderre
Copy link
Contributor Author

IN this case though we don`t want all keys output anyways.

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

3 participants