Force interface language by config file #792

Fermé
DearRude veut fusionner 1 révision(s) depuis DearRude/force-lang vers master
DearRude a commenté il y a 4 ans (Migré de github.com)

As explained in #785, trying to force the language interface which specified in .env file.

I tried the commented code below and re-compiled the front, but nothing happened. Since I didn't find any other piece which gets browser language, I assume my method of recompilation is flawed. (Only do cargo web deploy -p plume-front --release)

So I made this WIP PR as @igalic suggested. 😁

As explained in #785, trying to force the language interface which specified in `.env` file. I tried the commented code below and re-compiled the front, but nothing happened. Since I didn't find any other piece which gets browser language, I assume my method of recompilation is flawed. (Only do `cargo web deploy -p plume-front --release`) So I made this WIP PR as @igalic suggested. 😁
codecov[bot] a commenté il y a 4 ans (Migré de github.com)

Codecov Report

Merging #792 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #792      +/-   ##
==========================================
- Coverage   39.09%   39.08%   -0.02%     
==========================================
  Files          73       73              
  Lines        9756     9756              
  Branches     2233     2233              
==========================================
- Hits         3814     3813       -1     
  Misses       4885     4885              
- Partials     1057     1058       +1     
# [Codecov](https://codecov.io/gh/Plume-org/Plume/pull/792?src=pr&el=h1) Report > Merging [#792](https://codecov.io/gh/Plume-org/Plume/pull/792?src=pr&el=desc) into [master](https://codecov.io/gh/Plume-org/Plume/commit/d99b42582d7a5a8c8087b6ebe067b944cae0c294&el=desc) will **decrease** coverage by `0.01%`. > The diff coverage is `n/a`. ```diff @@ Coverage Diff @@ ## master #792 +/- ## ========================================== - Coverage 39.09% 39.08% -0.02% ========================================== Files 73 73 Lines 9756 9756 Branches 2233 2233 ========================================== - Hits 3814 3813 -1 Misses 4885 4885 - Partials 1057 1058 +1 ```
elegaanz a commenté il y a 4 ans (Migré de github.com)

The issue with the front-end is that it runs in the browser: it can't access the environment variables of the server.

I think the solution would be to:

  • first, do this change on the server side, where you can access the environment variables from the configuration. This may require you to change Plume-org/rocket-i18n first
  • then, once this settings works on the server, add a lang property to every <html> tag we render, containing the language code that we chose to render the page
  • in the front-end, use this lang attribute to detect the language instead of relying on navigator.language as we currently do.

I hope this isn't too much. I can try to guide you more if need detailed steps, I know it can be hard to get started on a codebase you know nothing about. Feel free to ask me here or on Matrix if you have any questions.

The issue with the front-end is that it runs in the browser: it can't access the environment variables of the server. I think the solution would be to: - first, do this change on the server side, where you can access the environment variables from the configuration. This may require you to change Plume-org/rocket-i18n first - then, once this settings works on the server, add a `lang` property to every `<html>` tag we render, containing the language code that we chose to render the page - in the front-end, use this `lang` attribute to detect the language instead of relying on `navigator.language` as we currently do. I hope this isn't too much. I can try to guide you more if need detailed steps, I know it can be hard to get started on a codebase you know nothing about. Feel free to ask me here or on Matrix if you have any questions.
Propriétaire

I assume my method of recompilation is flawed. (Only do cargo web deploy -p plume-front --release)

The feature is missing, so it's not the issue at hand, but doing just that was actually not sufficient. You must also rebuild Plume, as it's build script (build.rs) is the one copying files from target/ to where static files should be

> I assume my method of recompilation is flawed. (Only do `cargo web deploy -p plume-front --release`) The feature is missing, so it's not the issue at hand, but doing just that was actually not sufficient. You must also rebuild Plume, as it's build script (build.rs) is the one copying files from `target/` to where static files should be
Propriétaire
> [I give up on this. Could not make it work...](https://github.com/Plume-org/Plume/pull/792#issuecomment-650167801)
trinity-1686a a fermé cette pull request il y a 3 ans
Cette demande d'ajout ne peut pas être rouverte car la branche a été supprimée.
Vous pouvez également voir les instructions en ligne de commande.

Étape 1:

Depuis le dépôt de votre projet, sélectionnez une nouvelle branche et testez les modifications.
git checkout -b DearRude/force-lang master
git pull origin DearRude/force-lang

Étape 2:

Fusionner les modifications et mettre à jour sur Forgejo.
git checkout master
git merge --no-ff DearRude/force-lang
git push origin master
Connectez-vous pour rejoindre cette conversation.
Aucune évaluation
Aucun jalon
Pas d'assignataires
2 participants
Notifications
Échéance
La date d’échéance est invalide ou hors plage. Veuillez utiliser le format 'aaaa-mm-dd'.

Aucune échéance n'a été définie.

Dépendances

No dependencies set.

Reference: Plume/Plume#792
Chargement…
Il n'existe pas encore de contenu.