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

Extract all translatable strings from front-end code #2752

Closed
jnm opened this issue Aug 13, 2020 · 0 comments · Fixed by #2753
Closed

Extract all translatable strings from front-end code #2752

jnm opened this issue Aug 13, 2020 · 0 comments · Fixed by #2753
Assignees
Labels
translations workflow Related to development process

Comments

@jnm
Copy link
Member

jnm commented Aug 13, 2020

Related to kobotoolbox/form-builder-translations#3, we want to automatically extract strings from the UI code without a manual procedure that uses a desktop application. This will cut down on developer busywork and the long delay between application changes and updated translations.

  1. babel-loader loads ES6 sources and coffee-loader loads the CoffeeScript sources (i.e. form builder);
  2. We avoid calls to t() being turned into things like _utils__WEBPACK_IMPORTED_MODULE_8__["t"]) by not importing t but using webpack.ProvidePlugin instead;
  3. We use https://github.com/grassator/webpack-extract-translation-keys, which hooks into webpack's JavascriptParser to extract all static strings passed to t();
  4. We process the resulting file into something useful for upload to Transifex (TBD; let's address as part of Explore Transifex GitHub integration form-builder-translations#3).

In the future, when all code is ES6 or beyond, we may be better served by https://github.com/ttag-org/ttag.

@jnm jnm added translations workflow Related to development process labels Aug 13, 2020
@jnm jnm self-assigned this Aug 13, 2020
magicznyleszek added a commit that referenced this issue Nov 16, 2020
magicznyleszek added a commit that referenced this issue Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translations workflow Related to development process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant