-
Notifications
You must be signed in to change notification settings - Fork 40
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
Transliteration doesn't respect site default language #2637
Comments
Related issue, regarding taxonomy terms: #1995 |
Reminder: Have a look at English as well. There's no |
@olafgrabienski I've assigned this to you feel free to un-assign if you don't have the time or whatever. NOTES: @olafgrabienski and I did some prelim research on this; here is the rough draft code we have so far: file $site_langcode = config_get('system.core', 'language_default');
if (!empty($site_langcode)) {
$langcode = $site_langcode;
}
elseif (!empty($options['language']->langcode)) {
$langcode = $options['language']->langcode;
}
elseif (!empty($options['langcode'])) {
$langcode = $options['langcode'];
} This works in the case described in the OP, but we need to assure it works in multi-language scenarios as well. Like if the site has English, French and German and certain nodes should work in certain languages etc. |
@serundeputy I made a PR with your suggestion, putting the code just below After configuring Localization for the sandbox site, the change fixes the issue with German transliteration if German is set as site default language. That's great! But as assumed, transliteration doesn't work anymore for content of other languages, when the respective language is choosen on the single node (for content types with enabled "Multilingual support"). So, for the time being the situation is contrary to the original issue description: From the issue description:
Current situation: |
Writing up the steps to configure the sandbox and to test the PR, just in case we have to start over: Configure Localizationadmin/modules
admin/config/regional/language
admin/config/regional/language/detection
admin/config/urls/path/patterns/settings
Add Contentnode/add/post
Change post type settingsadmin/structure/types/manage/post/configure
Edit contentnode/3/edit
admin/config/regional/language
node/3/edit
|
So, as a next step, we have to look at these conditionals:
The goal is to let it work as following: To transliterate a URL alias, look first if there is a language setting on the node. If yes, use the node language. If not, use the site's default language. Any idea? |
Hi Olaf, please forgive my ignorance on this topic. Shouldn't the german sentence: Ärger im Büro ist schließlich immer möglich be always transliterated as aerger-im-buero-ist-schliesslich-immer-moeglich in all languages? Changing the diphthongs from ae to a, ue to u etc. changes the meaning of the title. |
@Dinornis Thanks for your question. I'm not expert, but I know that in English you can transliterate German Umlauts without the Apart from that, I guess my testing examples were misleading. I should have created different posts with different titles for the different examples to make it more clear. In my opinion, the question is however not how a German title is transliterated in different other languages. This can't be the question because the content / the node is not aware of the language you're typing in the title field. Can't explain it better at the moment, hoping to find time in a couple of days. |
I looked at the PR and reproduced the problem at hand. Thanks @olafgrabienski for the great instructions. I found it is possible to get Transliteration working as expected on content, but it's dependent upon the Content Translation module:
This works because the Node now has a Overall, this presents problems for single-language, non-English sites. They shouldn't need to turn on the Content Translation module if all their content is only in a single language. So I think the correct fix is to make it so that if Language module is enabled and a default language is set, that language should be used when creating content. |
I filed a PR at backdrop/backdrop#1850 that changes the default language used by nodes, both with or without Content Translation module. The default of new content is now the site language if another language has been added, or the site language is changed from English. I think this fixes the primary problem, but the solution may be incomplete. What about other types of entities? Do we need an upgrade path for this (if that's even possible)? |
@quicksketch Thanks for your PR! I like the approach to use the site's default language as node language. (It may even solve other issues with the language undefined which I remember only vaguely from D7.) I've had also a quick look at the PR sandbox, configured it to use transliteration, added some languages, made one default and created some nodes to test it. Works as expected, great! I tested also what happens to transliteration when you enable Multilingual support (Content translation module is not required to do so, btw) and change the language of a node, which dependent of the languages in question should result in a different URL alias. Looking at the browser address bar, in some cases the URL alias doesn't seem to reflect the changed language. But when you edit the node again and have a look at the vertical tab "URL settings", the correctly changed alias is visible. So, the changed URL alias is there, but it's not used in display mode. Strange! Example:
Can someone try to reproduce the issue? Finally: I can't estimate the questions regarding other entities or an upgrade path. Reminds me though that we have also transliteration for files. I try to have look at it next week. If we can't cover other entities with @quicksketch's PR , should we try to improve the first PR which may be less node specific? |
Just another idea as I had never issues with transliteration for URL aliases in Drupal. Should we have a look at the implementation in Drupal's Transliteration and/or Pathauto modules? |
Hm, I still like the approach but I'm not sure if it's the correct way for a bugfix. As reported in #2637 (comment), the PR of @quicksketch works for single-language, non-English sites, but it remains unclear if it works on multilingual sites (Feedback welcome). Additionally, there are open questions, e.g. how to handle other entities. As mentioned in #2637 (comment), 'my' PR works also for single-language, non-English sites, and it does not work on multilingual sites. Apparently even worse. I think however that it could be the right direction for a bugfix, if we just want to make sure transliteration works as it used to work in Drupal (and the Transliteration module). Comparing the respective files in Backdrop ( |
Great! The updated PR is still working for me. Regarding the different approaches (default language vs. interface language) it sounds reasonable to take the one which works fine in D7 and the Transliteration module. |
I added this to the "Help wanted" blog post as requested by @olafgrabienski. Can anyone provide a quick summary of where this issue is at and which Pull Requests are still being looked at or have we settled on one. It might be helpful to update the original post to clarify this. The PR listed in the original post is not consistent with the one linked in the right column. EDIT: I looked a little closer and the original post does seem to be up to date regarding PR assuming that backdrop/backdrop#3176 is the correct PR to be looking at. |
@stpaultim You're right, backdrop/backdrop#3176 is the correct PR. I've however updated the issue description to clarify the topic of the issue and which one is the current PR. |
I think the approach in the latest PR is fine. I read over backdrop/backdrop#3176 and the one thing I think is missing is that we have test coverage specifically for German now, but it's not clear how that transliteration is different than the English one. Could we save the same node title in both languages and then validate the differences between them? |
I enhanced the test as requested: two nodes, (almost) same title, different default languages - different path aliases. |
Friendly reminder: I updated the PR (test) as requested, so it's ready for another review. |
Thanks @indigoxela and sorry for taking that long to re-review. This is RTBC now 👍 |
...just to be sure, I've also re-tested in the fresh PR sandbox, following the steps from the issue summary. Everything still WFM 👍 |
Code and test looks good to me. |
Thanks @indigoxela, @quicksketch, @klonos, @olafgrabienski, @serundeputy & @herbdool! I've merged backdrop/backdrop#3176 into 1.x and 1.17.x. |
In German, certain characters are supposed to be transliterated language-specific. Example: The letter
ä
should be transliterated toa
for English but toae
for German. Backdrop doesn't deliver the language-specific transliterations unless you add Multilingual support to a content type and select the relevant language on the content items.Steps to reproduce:
admin/config/urls/path/patterns/settings
)Resulting URL alias:
posts/arger-im-buro
Expected alias:
posts/aerger-im-buero
Current PR by @indigoxela: backdrop/backdrop#3176 (transliterate neutral paths in current lang, like D7)
Outdated PRs:
PR by @olafgrabienski: backdrop/backdrop#1849(outdated)PR by @quicksketch: backdrop/backdrop#1850(outdated, conflicts)PR by @indigoxela: backdrop/backdrop#3175(set node langcode, closed in favor of different approach)Original issue description:
On a Backdrop 1.6.3 site which uses German as default language, transliteration for URL aliases and files are enabled and work generally, but they do not respect language-specific variations by default.
Certain characters are supposed to be transliterated language-specific. Example:
At the moment, Backdrop doesn't deliver language-specific transliterations of URL aliases, unless you add Multilingual support to a content type and select the relevant language on the content items.
(Note: For localized sites which use only one language there's usually no need to add multilingual support to content types, and it's not an acceptable workaround to do so.)
At the top of
core/includes/transliteration.inc
I see the following comment which makes me think that Backdrop should use the site's default language for language-specific transliterations:Unfortunately I don't have the skills to check
$source_langcode
in the code itself. Could someone have a look at it and give feedback how it's supposed to work and/or why it doesn't?The text was updated successfully, but these errors were encountered: