-
Notifications
You must be signed in to change notification settings - Fork 641
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
Unclear fallback behaviour for static translations #3692
Comments
Sorry, this was a side effect of 70a1c20. The reason is because Craft is (wrongly) assuming that the source It’s fixed for the next release now. You can patch your local install by updating your "require": {
"craftcms/cms": "dev-develop#2a78466ce2a7d4dddc127d99a86f3336b828978d as 3.1.3",
"...": "..."
} And then run Or you can create a <?php
return [
'components' => [
'i18n' => [
'translations' => [
'site' => [
'sourceLanguage' => 'de',
],
],
],
],
]; |
@brandonkelly I think this issue is back in 3.1.14, or at least something similar. |
@pju- Plugins actually can specify what their source language is. Just add this to your primary plugin class: public $sourceLanguage = 'xx-XX'; |
Description
I ran into a weird behaviour with static message translations. I think this came with the 3.1 Update.
I have the following site structure:
Primary: "Deutsch", Handle:
de
, Language:de
Second: "English", Handle:
en
, Language:en
Translation files:
de/site.php:
en/site.php:
template:
Output on DE page:
Output on EN page:
Now what happens:
If the translation file for
de
holds a key that has the exact same value ("Baum" => "Baum"
) it simply gets ignored and the system somehow gets the translation from theen/site.php
file. If the key does NOT equal the value ("Haus" => "Ein Gebäude"
), then it correctly pulls the translation fromde
. Currently half of my pages translations simply stopped working and some do still translate, very weird.So if a translation file has keys with the same value, it fallbacks to another language, which doesn't even is the primary language. It just fallbacks to
en
because it is english I guess? And also, it seems very unclear, why a fallback should happen, simply because the key equals a value. There should no fallback to another language at all.Also, if simply not providing a
site/de.php
file, the system also pulls translations fromen
, even if the craft.app.language isde
. This should never happen?Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: