Skip to content

Force interface language by config file#792

Open
DearRude wants to merge 1 commit intoPlume-org:mainfrom
DearRude:force-lang
Open

Force interface language by config file#792
DearRude wants to merge 1 commit intoPlume-org:mainfrom
DearRude:force-lang

Conversation

@DearRude
Copy link
Copy Markdown

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
Copy link
Copy Markdown

codecov bot commented Jun 23, 2020

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.08%. Comparing base (d99b425) to head (6405ba5).
⚠️ Report is 1262 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #792      +/-   ##
==========================================
- Coverage   39.09%   39.08%   -0.01%     
==========================================
  Files          73       73              
  Lines        9756     9758       +2     
  Branches     2233     2233              
==========================================
  Hits         3814     3814              
- Misses       4885     4887       +2     
  Partials     1057     1057              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elegaanz
Copy link
Copy Markdown
Member

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.

@elegaanz elegaanz added A: Backend Code running on the server A: Front-End Related to the front-end A: I18N Translations, and related code C: Feature This is a new feature S: Incomplete This PR is not complete yet labels Jun 23, 2020
@trinity-1686a
Copy link
Copy Markdown
Contributor

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

@DearRude
Copy link
Copy Markdown
Author

I give up on this. Could not make it work...

@elegaanz elegaanz changed the base branch from master to main July 5, 2020 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Backend Code running on the server A: Front-End Related to the front-end A: I18N Translations, and related code C: Feature This is a new feature S: Incomplete This PR is not complete yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants