Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
1.8k views
in Q2A Core by

Thank you for this amazing script!

I Have some problem with cyrillic URL on the site. In some browser not correct displayed question permalink! How i can replace (translit) permalink URL on the latin?

I choose firs URL show setting:

/123/why-do-birds-sing

But if post on the russian language or other cyrillic, i have somethink like this:

/123/%D0%BA%D1%8D%D0%BF-%D0%B0-%D1%8D%D1%82%D0%BE-%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE

I found code, what can change letter, but not understand where i should add this:

$question = str_replace(array(' ', "'",'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ь', 'ъ', 'ы', 'э', 'ю', 'я', 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ь', 'Ъ', 'Ы', 'Э', 'Ю', 'Я'), array('_','_','a', 'b', 'v', 'g', 'd', 'e', 'jo', 'zh', 'z', 'i', 'i', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'x', 'c', 'ch', 'sh', 'sch', 'j', 'j', 'y', 'e', 'y', 'ja', 'A', 'B', 'V', 'G', 'D', 'E', 'Jo', 'Zh', 'Z', 'I', 'I', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'X', 'C', 'Ch', 'Sh', 'Sch', 'J', 'J', 'Y', 'E', 'Y', 'Ja'), $question);

On the wordpress have plugin "rus-to-lat", what can translit letter in URL, but for q2a i can`t find...

Sorry for my English ;)

2 Answers

0 votes
by
да, так же интересует этот вопрос :)

yes, me to interesed it quest. because search engine bad decompiled url on cyrillic
+2 votes
by

You can perform this translation to the variable $title at the start of function qa_q_request(...) in qa-base.php - if you want to avoid having to reapply this to future versions of Q2A, you can wrap it up as an override in a plugin.

by
Thanks Gideon. I make it:
(on line ~1204)

$cyr = str_replace(array('а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ь', 'ъ', 'ы', 'э', 'ю', 'я'), array('a', 'b', 'v', 'g', 'd', 'e', 'jo', 'zh', 'z', 'i', 'i', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'ts', 'ch', 'sh', 'sch', 'j', 'j', 'y', 'e', 'y', 'ya'), $title);
        return (int)$questionid.'/'.$cyr;

its work! :)
by
Thank you very much, i`m try this!
by
Can you instruct more detail. I have the same issue, but I don't know how to fix it. Thank you so much.
by
Thanks for amazing script. I could make friendly seo url for Vietnamese q2a.

My title: Hang Sơn Đoòng cave ở đâu
My url: http://wiki.netdepviet.org/9/hang-son-doong-cave-o-dau
...