wagtail / wagtail-localize

Translation plugin for Wagtail CMS
https://wagtail-localize.org/
Other
223 stars 85 forks source link

Two Serbian locales shows the same content #766

Open rt-em opened 8 months ago

rt-em commented 8 months ago

I'm creating a new website. One languages of this website is Serbian. But there is one feature of Serbian language - it has two scripts: cyrillic and latin and both are widely used.

I created two locales: one for latin script and one for cyrillic.

I added this to settings

LANGUAGE_CODE = "sr-Latn"
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
    ('sr-Latn', "Srpski Latin"),
    ('sr-Cyrl', "Српски"),
    ('en', "English"),
]

The rest of setup is done staight according to Wagtail-localize documentation.

Expected behavior

/sr-latn/somepage/ - gives latin Serbian /sr-cyrl/somepage/ - gives cyrillic Serbian

How this works for real

/sr-latn/somepage/ - gives latin Serbian /sr-cyrl/somepage/ - also gives latin Serbian

In admin interface I can turn on all three locales, set up syncing between locales. And in admin I see three site trees for all three locales. I can create page within every locale and get unique translations for every locale of the same page. At this point everything seems good.

But when I'm going to the website both prefix pages /sr-latn/somepage/ and /sr-cyrl/somepage/ gives me only latin variant of page. If I will push "bird button" -> Edit this page on /sr-latn/somepage/ and on /sr-cyrl/somepage/ both link leads me to the same latin page in admin, even if both variants of page(latin and cyrillic) are exists.

For example: /admin/pages/19/edit/ - latin Serbian /admin/pages/21/edit/ - cyrillic Serbian But /sr-latn/somepage/ and /sr-cyrl/somepage/ refers only /admin/pages/19/edit/

I don't know is this the issue of wagtail-localize or wagtail, or may be django itself, but I'll be very appreciate if someone help me make everything works.

Upd I forget to mention, there is a workaround, instead of Latin Serbian it is posible to specify Croatian locale. But it is not desired setup, because languages are not identical. For example names of the months are completely different in this languages, and thats produces another issue for blog pages...

zerolab commented 8 months ago

I suspect this is a Django issue since all the routing happens via i18n_patterns as described in https://docs.wagtail.org/en/stable/advanced_topics/i18n.html#adding-a-language-prefix-to-urls. Do you get the same with if you use sr-latn for LANGUAGE_CODE, and sr-latn and sr-cyrl for WAGTAIL_CONTENT_LANGUAGES and LANGUAGES?

rt-em commented 8 months ago

Do you get the same with if you use sr-latn for LANGUAGE_CODE, and sr-latn and sr-cyrl for WAGTAIL_CONTENT_LANGUAGES and LANGUAGES?

Yes, sr-latn and sr-cyrl gives the same result...

rt-em commented 8 months ago

As I studied this is not so common that two scripts (and two locales as the result) corresponds to one language. And funny thing, that Django distinguishes Latin and Cyrillic alphabet for Serbian. And It seems that i18n uses just 'default' Serbian for both Latin and Cyrillic requests.