Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Setting config.default_locale / CONFIG_DEFAULT_LOCALE updates default locale of the site #578

Merged
merged 3 commits into from
Jul 18, 2024

Conversation

tbiering
Copy link
Contributor

Description

This pull requests includes a fix for the non-working configuration option config.default_locale / CONFIG_DEFAULT_LOCALE.
Setting the value now properly applies the locale for any unregistered user visiting the site.
Visiting the site as a registered user still applies the locale set in the user's profile.

The fix has been tested by using configuration value set in the environment variables of the docker-compose.yml

Example for CONFIG_DEFAULT_LOCALE="de"

services:
  thunderdome:
    build:
      context: .
      dockerfile: ./build/Dockerfile
    restart: always
    ports:
      - "8080:8080"
    depends_on:
      - db
    links:
      - db
    networks:
      - asgard
    environment:
      APP_DOMAIN: ".127.0.0.1"
      COOKIE_SECURE: "false"
      # CONFIGURATION FOR TESTING
      CONFIG_DEFAULT_LOCALE: "de"
      # --- CONFIGURATION FOR TESTING
      SMTP_SECURE: "false"
      SMTP_HOST: mail
      SMTP_PORT: 1025
      DB_NAME: thunderdome
      DB_USER: thor
      DB_PASS: odinson
    volumes:
      - ./etc:/etc/thunderdome
[...]

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Fixes #577

Screenshots/Recordings

Before fix: before-fix_locale-all

After fix:

Steps to QA

  1. Set environment variable CONFIG_DEFAULT_LOCALE to "de" using configuration in docker-compose.yml (see above)
  2. Start up using docker-compose up --build
  3. Validate that the preselected language is now german using the language selector button.
  4. Parts of the site are now displayed in german - use the "login"-button for reference. It should now be labeled "Anmeldung".
    (Note: Only parts of the translation file are currently translated)

@tbiering tbiering marked this pull request as draft May 16, 2024 16:03
@tbiering
Copy link
Contributor Author

I just notices that my fix included modifications to an auto-generated file 🤦‍♂️. I will work on the fix and update the PR accordinly.

@tbiering tbiering marked this pull request as ready for review May 16, 2024 16:47
@StevenWeathers StevenWeathers merged commit 47efbae into StevenWeathers:main Jul 18, 2024
9 checks passed
@tbiering tbiering deleted the fix-default-locale branch July 18, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: config.default_locale / CONFIG_DEFAULT_LOCALE does not change the default locale of the site
2 participants