Transliteration in topic URL


Some word Vietnamese sign will convert ugly when have sign: ă; â; ơ; ô; ả; ã

Cần thuê mặt bằng 2 MT mở quán cà phê có thể ở lại giá 10tr trở về

will convert to


i wanna convert to

can thue mat bang 2 mt mo quan ca phe co the o lai gia 10tr tro ve

On wordpress, title topic vietnamese convert beauty, full text only removed sign


@gerhard any ideas?

Looks like it’s working fine when we explicitely set the locale

(Note: parameterize internally calls transliterate)

> I18n.transliterate("Cần")
=> "C?n"
> I18n.transliterate("Cần", locale: "vi")
=> "Can"

We should probably set I18n.locale to the value of SiteSetting.default_locale?

1 Like

Your default locale is set to English and the system doesn’t know how to correctly transliterate Vietnamese characters in that case. Either change the default locale site setting to Vietnamese or change the slug generation method site setting to “encoded”.

That’s exactly what’s happening in the app, but you have to do it manually in the rails console. :wink:
So, I guess the only thing we should do here is to put a I18n.with_locale(SiteSetting.default_locale) in Slug.ascii_generator, because currently it will use the user’s locale when allow user locale is enabled. Which is kinda weird.


Can you add that to your list?

1 Like

Fixed in FIX: Generate ASCII slug with default locale · discourse/discourse@56f6065 · GitHub