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

files with .jsx extensions is not being scanned to export #19

Open
eriknyk opened this issue Aug 31, 2015 · 2 comments
Open

files with .jsx extensions is not being scanned to export #19

eriknyk opened this issue Aug 31, 2015 · 2 comments

Comments

@eriknyk
Copy link

eriknyk commented Aug 31, 2015

Hi,
I'm trying to export the labels, using:

./node_modules/.bin/i18nliner export

there is a way to configure which file type you want to scan file to extract the translatable labels?
I guess I need to add it in .i18nrc file, but I didn't found any example of it.

Regards.

@jenseng
Copy link
Owner

jenseng commented Sep 1, 2015

There's not currently an .i18nrc setting --- this pull request is one approach, but I think I want to do something more flexible that supports multiple processers, e.g. js vs hbs

In the meantime, it can be accomplished with a custom i18nliner plugin... basically create a file i18nliner-jsx.js like so:

module.exports = function(i18nliner) {
  var JsProcessor = i18nliner.processors.JsProcessor;
  JsProcessor.prototype.defaultPattern = ["*.js", "*.jsx"];
};

Then add the plugin to your .i18nrc like so:

{
  "plugins": [
    "react-i18nliner",
    "../../../../relative/path/to/i18nliner-jsx"
  ],
  "directories": ["jsapp"]
}

Unfortunately the "../../../.." is currently necessary, since it's resolved relative to node_modules/i18nliner/dist/lib/i18nliner.js

@eriknyk
Copy link
Author

eriknyk commented Sep 2, 2015

Thank you @jenseng I will try it!

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