Force interface language by config file #792

クローズ
DearRude が DearRude/force-lang から master への 1 コミットのマージを希望しています
DearRude がコメント 4年前 (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] がコメント 4年前 (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 がコメント 4年前 (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.
trinity-1686a がコメント 4年前
オーナー

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
trinity-1686a がコメント 3年前
オーナー
> [I give up on this. Could not make it work...](https://github.com/Plume-org/Plume/pull/792#issuecomment-650167801)
trinity-1686a がプルリクエストをクローズ 3年前
このプルリクエストはブランチが削除されているため、再オープンできません。
コマンドラインの手順も確認できます。

ステップ 1:

あなたのプロジェクトリポジトリで新しいブランチをチェックアウトし、変更内容をテストします。
git checkout -b DearRude/force-lang master
git pull origin DearRude/force-lang

ステップ 2:

変更内容をマージして、Forgejoに反映します。
git checkout master
git merge --no-ff DearRude/force-lang
git push origin master
サインインしてこの会話に参加。
レビューアなし
マイルストーンなし
担当者なし
2 人の参加者
通知
期日
期日が正しくないか範囲を超えています。 'yyyy-mm-dd' の形式で入力してください。

期日は未設定です。

依存関係

依存関係が設定されていません。

リファレンス: Plume/Plume#792
読み込み中…
まだ内容がありません