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

Investigate if we can reduce translations file size in JS #2687

Open
ferblape opened this issue Nov 20, 2019 · 2 comments
Open

Investigate if we can reduce translations file size in JS #2687

ferblape opened this issue Nov 20, 2019 · 2 comments

Comments

@ferblape
Copy link
Member

@Crashillo has been investigating a bit how to reduce the size of the JS packs by reducing the translations file:

  • check the namespaces in ignore-missing and ignore-unused. These options were filled with keys used in JS because Ruby wasn't able to detect them. It seems that it has been improved and we can check again

  • investigate if we can skip English translations when dumping the JS file

@Crashillo
Copy link
Member

Checking its docs I'm seeing really interesting things, as:

Create multiple files by language:

translations:
- file: 'public/javascripts/en.js'
  only: 'en.*'
- file: 'public/javascripts/pt-BR.js'
  only: 'pt-BR.*'

Use loops in the config file:

translations:
<% Widgets.each do |widget| %>
- file: <%= "'#{widget.file}'" %>
  only: <%= "'#{widget.only}'" %>
<% end %>

We might split translations into files such as:

es.gobierto_MODULE.js
ca.gobierto_MODULE.js
es.gobierto_common.js
...

In such a way that the import would bring only the current locale files

@Crashillo
Copy link
Member

I removed the import for a packs, and I noticed the following:

imagen

The texts keep working as they're coming from backend, so:
Does it worth ONLY generate those which are required in javascript? Append a namespace for them (like js.gobierto_....) and creates a very much simpler files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants