web icon indicating copy to clipboard operation
web copied to clipboard

Prevent loading all languages for all apps on initial page load

Open JammingBen opened this issue 1 year ago • 3 comments

Since we've introduced so many languages, the initial page loading times have gone down quite a lot. This happens due to the fact that we're loading all available languages for all apps during the initial load.

The goal of this issue is to prevent that and to just load the current language initially. Other languages are then being loaded on language change.

JammingBen avatar Jun 12 '24 14:06 JammingBen

We need to split the translations.json into separate json files (e.g. de.json, ru.json etc.) https://jshmrtn.github.io/vue3-gettext/extraction.html This can happen via

    splitJson: false, // create separate json files for each locale. If used, jsonPath must end with a directory, not a file

set to true

AlexAndBear avatar Jun 12 '24 14:06 AlexAndBear

Could possibly be implemented in multiple iterations as well...

  1. do not merge and register everything all at once
  2. really load on demand (async, so probably more complicated)

dschmidt avatar Jun 12 '24 14:06 dschmidt

Okay so https://github.com/owncloud/web/pull/11040 prevents merging and registering all app languages on page load.

Splitting the languages into multiple files and loading them dynamically is not easy though. The splitting itself can be done without too much effort, but then we would need to implement some architecture so that translations can be dynamically loaded per app. So each app would need to provide a way to load translations for a given language on demand.

We don't have anything in that regard yet, and to be honest, I'm not sure if it's worth the effort currently.

JammingBen avatar Jun 13 '24 09:06 JammingBen