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

default-lang logic #3872

Open
domhaas opened this issue Nov 20, 2024 · 2 comments
Open

default-lang logic #3872

domhaas opened this issue Nov 20, 2024 · 2 comments

Comments

@domhaas
Copy link

domhaas commented Nov 20, 2024

I'm a bit confused about the language settings:
I have two languages: de,en - de should be the default language.

Everything works so far, but when I look at the context info for a page, ‘de’ is shown in red, although this is actually the default language.

This is confusing for my customer because he thinks something is missing in the translations.

image

Config:

languages:
  supported:
    - de
    - en
  default_lang: null
  include_default_lang: false
  include_default_lang_file_extension: false
  translations: true
  translations_fallback: true
  session_store_active: false
  http_accept_language: false
  override_locale: false
  pages_fallback_only: false
  debug: false

There are two files per folder:
default.md
default.en.md

If I change the settings and create a default.de.md, then ‘de’ is green but the default language is red.

Not any better.

Thanks for a quick tip.

@pamtbaau
Copy link
Contributor

pamtbaau commented Nov 26, 2024

I'm a bit confused about the language settings

You might be right...

AFAIK, *.md does not represent the default language, it is a fallback when the default language is not available as fallback for other languages. This behaviour can be overridden by setting custom language fallbacks using languages.content_fallback in /user/config/system.yaml
If there is no page for the default language and no *.md page, a 404 will be returned.

The colour of the languages indicates if for a supported language and *.md a dedicated file is available.

Let's assume the following supported languages [de, fr, en].

  • 'de' is the default language, or the primary fallback language.
  • If for some page, there is no *.de.md, the secondary fallback will be *.md.

Consider the following files:

/typography
  /default.md
  /default.de.md
  • Both 'fr' and 'en' will fallback to the default language: *.de.md
  • 'de' will show *.de.md
  • *.md is not being used, because the default language is available

Now consider the following files:

/typography
  /default.md
  /default.fr.md
  • 'de' will fallback to *.md
  • 'fr' will show *.fr.md
  • 'en' will fallback to *.md

Hope this helps...

@domhaas
Copy link
Author

domhaas commented Nov 27, 2024

@pamtbaau Thank you very much! Yeah it seems that this is some kind of "technical correct" but on the enduser-side a little bit confusing.

Maybe I'm going to create a merge-request for that. Thinking of something like that:

image

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

No branches or pull requests

2 participants