Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Move languages to package and load locally #1068

Closed
tacman opened this issue Apr 17, 2020 · 3 comments · Fixed by #1110
Closed

Move languages to package and load locally #1068

tacman opened this issue Apr 17, 2020 · 3 comments · Fixed by #1110
Labels

Comments

@tacman
Copy link
Contributor

tacman commented Apr 17, 2020

Description:

During rendering, the formbuilder loads language files from the network, rather than locally. As you can see, this add almost 6 seconds to my page rendering:

image

Can these files be moved into the package, so they can be loaded locally? Or configured, so they could be on a cdn or whatever.

Environment Details:

  • formBuilder Version: 3.4.1
  • Browser: Firefox
  • OS: Ubuntu 18.04

Expected Behavior

No outside network activity

@tacman
Copy link
Contributor Author

tacman commented Apr 19, 2020

I've done some digging and found the reference, but don't know how to override it. In config.js, the location is se:

export const defaultI18n = {
  location: 'https://formbuilder.online/assets/lang/',
}

I'm no javascript expert, so I couldn't figure out how to set this in the options, but even if I could, it appears the language files are not included in the installation or even the source of the package. @kevinchappell , where are these languages files, and can they be included in the package so that using formBuilder doesn't require a network connection? Thanks.

@kevinchappell
Copy link
Owner

kevinchappell commented Apr 19, 2020

@tacman

so I couldn't figure out how to set this in the options

i18n config can be set via plugin options: https://formbuilder.online/docs/formBuilder/options/i18n/

appears the language files are not included in the installation

only the English is included to keep the package light. There are 28 languages but the most commonly used language is English. Including the other languages would add an additional 102.6kb to the package.

image

If it takes 5.8 seconds to load a 3.8kb language file, the additional languages would add over 2 to your load time.

where are these languages files, and can they be included in the package

The language files were moved to their own repo so they could be developed and published independently of formBuilder. They can be found in the following locations.

so that using formBuilder doesn't require a network connection

English is hardcoded into the plugin and should work without internet:
image

The plugin still makes a request for the default language (English unless changed) incase the developer has set the i18n.location option and is expecting to load a custom default language from said location.

kevinchappell added a commit that referenced this issue Aug 22, 2020
devServer should use local language files for development sans internet. resolves #1068
kevinchappell added a commit that referenced this issue Aug 22, 2020
devServer should use local language files for development sans internet. resolves #1068
github-actions bot pushed a commit that referenced this issue Aug 22, 2020
## [3.4.3](v3.4.2...v3.4.3) (2020-08-22)

### Bug Fixes

* copy language files from module ([0fee6c3](0fee6c3)), closes [#1068](#1068)
@kevinchappell
Copy link
Owner

🎉 This issue has been resolved in version 3.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants