Hello, in some project i need same alias for all language, without translate entity to other language. I think it exists sense.
That i meen, create button to generate source language alias for all language.
Have two language EN and RU
Taxonomy exemple > term name HTC
How it work know
path En > /en/htc
path RU > /ru/taxonomy/term/1
I need translate taxonomy just for create alias? I think is not good for some reason.
but i need
path En > /en/htc
path RU > /ru/htc
????
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2863230-16.patch | 1004 bytes | hchonov |
| #9 | uniq_alias-2863230-9.patch | 628 bytes | dimr |
Comments
Comment #2
cmsmindsHello Regnoy,
For your issue, it may be resolved by Pathauto i18n.
Comment #3
pavelculacov commentedThanks, we it not integrate in main module?
Comment #4
sohinicp commentedHi Regnoy,
Just install i18n module which includes submodule i18n_path module. It helps to translate taxonomy term.
After installing i18n, only 2 steps you have to follow:
1.When you are creating vocabulary just select "Localize. Terms are common for all languages, but their name and description may be localized." as multilingual options.
2. Then change the pattern for your vocabulary path as "[term:name]".
Then you get the path of taxonomy term as required :
path En > /en/htc
path RU > /ru/htc
Please try.
Comment #5
dimr commentedI have the same issue but with normal content types, I am using [node:source:title] to generate the URL alias, and in general works, but in my case the default language is German.
Having a title as "Bärte und Als"
because there are some "Umlaut" as ä,ü,ö
then in the German URL alias, I get something like
"baerte-und-als"
but in the English I get
"barte-und-als"
From my point of view is as pathauto is using different encoding to generate the Url, and if it is taking the German Title to make the URL, even if the English alias, it should use the same encoding or just use the same alias as in the German content, I guess.
Comment #6
dimr commentedThanks to @michaellenahan I have fixed my problem unchecking the checkbox
"Transliterate prior to creating alias" in the pathauto config page "/admin/config/search/path/settings" and now it works!
Now I get "bärte-und-als" in both languages.
Comment #7
dimr commentedComment #8
Chris CharltonSeems like this issue can be marked 'Works as Designed'.
Comment #9
dimr commentedThe option of unchecking the transliteration was at the end no a solution for our customers.
In German there are umlauts (ü,ö,ä) and in the URL should be transliterated to (ue,oe,ae), what means that we need to enable the transliteration option.
Using the patch 96 from the issue in core https://www.drupal.org/project/drupal/issues/2689459 I got the same URL in German and in English, the problem was that when saving the content in the English version was getting the English schema to generate the URL for both content, EN and DE version and when editing the content in the German version was getting the German Schema.
Applying this patch both content, English and German versions has the same URL using the Default Language Schema, German in my case.
What makes both URLs be the same, saving what every version language of the content and using transliteration for pathauto.
Comment #11
Chris CharltonActually, I need this to: the ability to enable Transliterate on certain patterns only, not a global setting for all patterns.
Comment #12
drupalfan2 commentedI need this patch #9 or a similar patch for one content type.
It is a multilingual page (3 languages). Some content is translated (by admins). User generated content is not translated.
For this reason and for some other reasons this content type has no default language, this content type is language-neutral.
The language for entities of this content type is undefined ("und").
So the line in the patch
$langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();helps to still get the correct tansliteration for german Umlaute ("ö" -> "oe", "ä" -> "ae", "ü" -> "ue") even if the entity language is undefined.
We should extend this patch for general use (whenever language is undefined or similar ...) and apply the adjusted patch to pathauto module
Comment #13
drupalfan2 commentedI found out that this patch #9 causes a lot of problems!!
Aliases for other languages than "de" are not created anymore. This is why the language is fixed to "de" through this line:
$langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();I will never use this patch or similar solutions!!!
My solution is much better. In my costum module I wrote this code:
This works and causes no other problems.
Comment #14
fvd commentedWhere is the setting made? #13
I'm new to drupal, in the web/sites/default/settings.php
has it been tried without success?
Comment #15
drupalfan2 commentedAs I wrote: In my costum module!
In most Drupal projects it is useful to write and use a custom module to make adjustments.
Comment #16
hchonovOur use case is like this that we have a content type that is not translatable, but the site has multiple languages enabled without language detection enabled and it is possible to create content in that content type for different languages. However since pathauto automatically creates the aliases with the language of the entity if we would create content in a non-default site language then we cannot visit the url of the page. I think that we need an approach similar to #2689459: If you don't want to translate your URL alias, the original URL alias won't work with your translations that will set the language to undefined in case the entity is not translatable. The only issue I can think of is though what should happen if the content type is made translatable at a later point, so this needs to be defined and tested how the aliases old and new will behave.
Comment #17
geek-merlin@hchonov: Nice to meet you again here. We face a similar problem and your approach pointed me in the right direction.
Made an overview #3482672: Overview of Pathauto language problems and approaches with some more pointers and what core does ("und if entity OR path field is untranslatable"). HTH!
Comment #18
mably commentedClosing as a duplicate of #2689459.
Looks like the only solution if you want to have a unique (untranslated) path for content with multiple translations.
Comment #20
hchonov@mably we need both #2689459: If you don't want to translate your URL alias, the original URL alias won't work with your translations and the changes made in here, so the issue still applies for the problem and we need more changes than the core ones.
Comment #21
mably commented@hchonov can you provide an MR please?