Force interface language by config file #792

Fechado
DearRude quer aplicar o merge de 1 commits de DearRude/force-lang em master
DearRude comentou 4 anos atrás (Migrado 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] comentou 4 anos atrás (Migrado 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 comentou 4 anos atrás (Migrado 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.
Proprietário

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
Proprietário
> [I give up on this. Could not make it work...](https://github.com/Plume-org/Plume/pull/792#issuecomment-650167801)
trinity-1686a fechou este pull request 3 anos atrás
Este pull request não pode ser reaberto porque o branch foi excluído.
Você também pode ver as instruções para a linha de comandos.

Passo 1:

No repositório do seu projeto, crie um novo branch e teste as alterações.
git checkout -b DearRude/force-lang master
git pull origin DearRude/force-lang

Passo 2:

Faça merge das alterações e atualize no Forgejo.
git checkout master
git merge --no-ff DearRude/force-lang
git push origin master
Acesse para participar desta conversação.
Sem revisor
Sem marco
Sem responsável
2 participante(s)
Notificações
Data limite
A data limite é inválida ou está fora do intervalo. Por favor, use o formato 'dd/mm/aaaa'.

Data limite não informada.

Dependências

Nenhuma dependência definida.

Referência: Plume/Plume#792
Carregando…
Ainda não há conteúdo.