I've interpreted your second email exactly the same as your first, so I can
only reply the same, perhaps a bit more clearly.

Since you mentioned trying Django's slugify function instead of
Mezzanine's, presumably you've found the setting for configuring the
slugify function used:

http://mezzanine.jupo.org/docs/configuration.html#slugify

Powered with the ability to swap out the function, all you need now is the
function. Like I said, Googling finds one right away. I have to confess, I
actually searched for "unicode slugify", not "slugify unicode" as I
originally mentioned (and which I think you thought of as a reference to
the function name in Mezzanine, but I don't know). Anyway, here's the first
result:

https://github.com/mozilla/unicode-slugify

Here's an example from it doing exactly what you described:

# Replace non ascii chars with their "best" representation
slugify(u'北京 (capital of China)', only_ascii=True)
# u'bei-jing-capital-of-china'

Good luck.




On Mon, Jan 11, 2016 at 1:25 PM, <[email protected]> wrote:

> Yes it is but it is not that i want =)
> Sorry for my poor english. May be you did not correctly understand my
> previous message.
> I want to convert any unicode symbols to english ascii symbols.
> slugify_unicode makes url with russian characters if page title is in
> russian. It is not that i want.
> And django's slugify simply strips non-ascii characters. It not that I
> want too.
> Is there any way to convert (transliterate) unicode to ascii on the fly
> without additional programming? Any config option or something like this?
>
> понедельник, 11 января 2016 г., 1:48:31 UTC+3 пользователь Stephen
> McDonald написал:
>>
>> The first dozen or so results in Google when searching for
>> "slugify unicode" reveal exact what you want.
>>
>> On Mon, Jan 11, 2016 at 12:01 AM, <[email protected]> wrote:
>>
>>> Hi guys,
>>>
>>> I have a site with russian locale and want to convert non-ascii slugs
>>> into ascii one to avoid ugly urlencoded urls.
>>> I've replaced Mezzanine's slugify with Django's
>>> default django.template.defaultfilters.slugify but it just strips non-ascii
>>> characters but i want to transliterate them.
>>> Is there any way to do it in Mezzanine without making own slugify?
>>>
>>> Thnx for any answer.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Stephen McDonald
>> http://jupo.org
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to