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 front-end translatable strings #2753

Merged
merged 8 commits into from
Nov 14, 2020

Conversation

jnm
Copy link
Member

@jnm jnm commented Aug 13, 2020

…to the file jsapp/compiled/extracted-strings.json when npm run build / webpack --config webpack/prod.config.js is executed. Going forward:

  • t() must be the function call used to surround translatable strings, i.e. do not assign t to another variable and expect string extraction to continue working;
  • call t() only with static strings;
  • do not import t() manually anywhere, e.g. import {t} from './utils' must be avoided: t() is now provided globally by webpack.ProvidePlugin.

Description

Extract all translatable strings from front-end code to a single file, with the eventual goal of automatically updating Transifex

Related issues

Closes #2752

webpack-extract-translation-keys can extract them
strings to jsapp/compiled/extracted-strings.json; add
webpack-extract-translation-keys-plugin as new dependency; concatenate
elements of arrays in webpack dev/prod configurations to arrays in the
common configuration instead of discarding the common arrays
@jnm jnm force-pushed the 2752-extract-front-end-translatable-strings branch from c842330 to ccfbcec Compare August 13, 2020 07:52
@magicznyleszek
Copy link
Member

@jnm do you want to fix the merge conflict? (and one thing from review :-P)

# Conflicts:
#	jsapp/js/components/table.es6
#	jsapp/js/editorMixins/assetNavigator.es6
#	jsapp/xlform/src/mv.skipLogicHelpers.coffee
#	jsapp/xlform/src/mv.validationLogicHelpers.coffee
#	jsapp/xlform/src/view.row.templates.coffee
#	jsapp/xlform/src/view.rowDetail.SkipLogic.coffee
#	jsapp/xlform/src/view.rowSelector.templates.coffee
#	jsapp/xlform/src/view.surveyApp.templates.coffee
@magicznyleszek magicznyleszek merged commit 196dd63 into master Nov 14, 2020
@magicznyleszek magicznyleszek deleted the 2752-extract-front-end-translatable-strings branch November 14, 2020 01:15
magicznyleszek added a commit that referenced this pull request Nov 16, 2020
magicznyleszek added a commit that referenced this pull request Nov 16, 2020
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

Successfully merging this pull request may close these issues.

Extract all translatable strings from front-end code
2 participants