Osclass Support Forums
General osclass questions => Report bug => Topic started by: Ivanko on June 13, 2021, 06:05:23 PM
-
There is an error in formatting.php
Please use below code
//ru_RU translit
if (is_utf8($string)) {
$chars = array(
"А"=>"a","Б"=>"b","В"=>"v","Г"=>"g",
"Д"=>"d","Е"=>"e","Ж"=>"z","З"=>"z","И"=>"i",
"Й"=>"j","К"=>"k","Л"=>"l","М"=>"m","Н"=>"n",
"О"=>"o","П"=>"p","Р"=>"r","С"=>"s","Т"=>"t",
"У"=>"u","Ф"=>"f","Х"=>"h","Ц"=>"c","Ч"=>"ch",
"Ш"=>"sh","Щ"=>"w","Ъ"=>"","Ы"=>"i","Ь"=>"",
"Э"=>"e","Ю"=>"ju","Я"=>"ja","а"=>"a","б"=>"b",
"в"=>"v","г"=>"g","д"=>"d","е"=>"e", "ё"=>"e","ж"=>"z",
"з"=>"z","и"=>"i","й"=>"j","к"=>"k","л"=>"l",
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
"ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"w","ъ"=>"y",
"ы"=>"i","ь"=>"","э"=>"e","ю"=>"ju","я"=>"ja",
" "=> "-", "."=> "", "/"=> "-", "-" => "-");
$string = strtr($string, $chars);
}
//ru_RU translit
or at least correct chars
your letters are wrong
$cyr = array('а','б','в','г','д','ѓ','е','ж','з','ѕ','и','ј','к','л','љ','м','н','њ','о','п','р','с','т','ќ','у','ф','х','ц','ч','џ','ш','А','Б','В','Г','Д','Ѓ','Е','Ж','З','Ѕ','И','Ј','К','Л','Љ','М','Н','Њ','О','П','Р','С','Т','Ќ','У','Ф','Х','Ц','Ч','Џ','Ш','€');
$lat = array('a','b','v','g','d','gj','e','zh','z','dz','i','j','k','l','lj','m','n','nj','o','p','r','s','t','kj','u','f','h','c','ch','dz','sh','A','B','V','G','D','GJ','E','ZH','Z','DZ','I','J','K','L' ,'LJ' ,'M' ,'N' ,'NJ' ,'O' ,'P', 'R', 'S', 'T','KJ','U','F','H','C','CH','DZ','SH','EUR');
$string = str_replace($cyr, $lat, $string);
what chars are below ) ?
ѓ , љ , њ, € ... etc )))
-
@Ivanko
what chars are below ) ?
ѓ , љ , њ, € ... etc
Checking code you've posted and they are not mentioned here.
$chars = array( "А"=>"a","Б"=>"b","В"=>"v","Г"=>"g", "Д"=>"d","Е"=>"e","Ж"=>"z","З"=>"z","И"=>"i", "Й"=>"j","К"=>"k","Л"=>"l","М"=>"m","Н"=>"n", "О"=>"o","П"=>"p","Р"=>"r","С"=>"s","Т"=>"t", "У"=>"u","Ф"=>"f","Х"=>"h","Ц"=>"c","Ч"=>"ch", "Ш"=>"sh","Щ"=>"w","Ъ"=>"","Ы"=>"i","Ь"=>"", "Э"=>"e","Ю"=>"ju","Я"=>"ja","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e", "ё"=>"e","ж"=>"z", "з"=>"z","и"=>"i","й"=>"j","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"w","ъ"=>"y", "ы"=>"i","ь"=>"","э"=>"e","ю"=>"ju","я"=>"ja", " "=> "-", "."=> "", "/"=> "-", "-" => "-");
-
@Ivanko
what chars are below ) ?
ѓ , љ , њ, € ... etc
Checking code you've posted and they are not mentioned here.
$chars = array( "А"=>"a","Б"=>"b","В"=>"v","Г"=>"g", "Д"=>"d","Е"=>"e","Ж"=>"z","З"=>"z","И"=>"i", "Й"=>"j","К"=>"k","Л"=>"l","М"=>"m","Н"=>"n", "О"=>"o","П"=>"p","Р"=>"r","С"=>"s","Т"=>"t", "У"=>"u","Ф"=>"f","Х"=>"h","Ц"=>"c","Ч"=>"ch", "Ш"=>"sh","Щ"=>"w","Ъ"=>"","Ы"=>"i","Ь"=>"", "Э"=>"e","Ю"=>"ju","Я"=>"ja","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e", "ё"=>"e","ж"=>"z", "з"=>"z","и"=>"i","й"=>"j","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"w","ъ"=>"y", "ы"=>"i","ь"=>"","э"=>"e","ю"=>"ju","я"=>"ja", " "=> "-", "."=> "", "/"=> "-", "-" => "-");
ѓ , љ , њ, € ... etc
those wrong chars are in the last osclass ver 4.4.0, inside in file formatting.php
-
@Ivanko
I still do not understand, what is wrong on € ?
-
@Ivanko
I still do not understand, what is wrong on € ?
The chars what you use in formatting.php for ru-ru are not existing in ru alphabet.
Please replace chars with what i have provided.
ѓ , љ , њ, € ... etc
Those chars above are not exist, it is more looks as ehieroglyphs))
There are many miss matches
$cyr = array('а','б','в','г','д','ѓ','е','ж','з','ѕ','и','ј','к','л','љ','м','н','њ','о','п','р','с','т','ќ','у','ф','х','ц','ч','џ','ш','А','Б','В','Г','Д','Ѓ','Е','Ж','З','Ѕ','И','Ј','К','Л','Љ','М','Н','Њ','О','П','Р','С','Т','Ќ','У','Ф','Х','Ц','Ч','Џ','Ш','€')
In red ink are not existing letters in RU alphabet
Also you have 31 chars, must be 33, 2 letters are gone )
https://ru.wikipedia.org/wiki/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9_%D0%B0%D0%BB%D1%84%D0%B0%D0%B2%D0%B8%D1%82 (https://ru.wikipedia.org/wiki/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9_%D0%B0%D0%BB%D1%84%D0%B0%D0%B2%D0%B8%D1%82)
-
@Ivanko
We are not trying to do cyrilic for Russia only/or/separately.
https://en.wikipedia.org/wiki/Gje
-
@Ivanko
We are not trying to do cyrilic for Russia only/or/separately.
https://en.wikipedia.org/wiki/Gje
Then you can include all 53 letters Slavic and not 31
€ - this also not part of cyrilic)
-
@Ivanko
There does not make sense to be strict what is and what is not cyrilic, but what may be in URL and what should not be there :)
I think having € sign is not good as well.
-
@Ivanko
There does not make sense to be strict what is and what is not cyrilic, but what may be in URL and what should not be there :)
I think having € sign is not good as well.
This is a key - missed letters in last osclass core not making correct url...
Let me know if you plan to fix it ?
Or I can proved full translite and you can add it in next update, so we can fix the bug.
-
@ivanko
Please only provide new letters and their mapping.
-
$str = "А а Б б В в Г г Ґ ґ Д д Ђ ђ Е е Ё ё Ж ж З з З́ з́ И и Й й Ѝ ѝ І і Ї ї Ј ј К к Л л Љ љ М м Н н Њ њ О о Ō ō П п Р р С с С́ с́ Т т Ћ ћ Ќ ќ У у Ӯ ӯ Ў ў Ф ф Х х Ц ц Ч ч Џ џ Ш ш Щ щ Ъ ъ Ы ы Ь ь Э э Ю ю Я я";
$map ="A a B b V v G g Gj gj D d Dz dz E e Jo jo Zh zh Z z Z z I i J j J j J j J j J j K k L l Lj lj M m N n Nj nj O o O o P p R r S s S s T t T t Kj kj U u U u U u F f H h C c Ch ch Dzh dzh Sh sh Shh shh ## # Y y '' ' Je je Ju ju Ja ja";
97 elements without zero )
space is separator.
-
@Ivanko
Please send it in one of format used by osclass right now.
-
// update cyrilic to latin
$cyr = array('А','а','Б','б','В','в','Г','г','Ґ','ґ','Д','д','Ђ','ђ','Е','е','Ё','ё','Ж','ж','З','з','З́','з́','И','и','Й','й','Ѝ','ѝ','І','і','Ї','ї','Ј','ј','К','к','Л','л','Љ','љ','М','м','Н','н','Њ','њ','О','о','Ō','ō','П','п','Р','р','С','с','С́','с́','Т','т','Ћ','ћ','Ќ','ќ','У','у','Ӯ','ӯ','Ў','ў','Ф','ф','Х','х','Ц','ц','Ч','ч','Џ','џ','Ш','ш','Щ','щ','Ъ','ъ','Ы','ы','Ь','ь','Э','э','Ю','ю','Я','я');
$lat = array('A','a','B','b','V','v','G','g','Gj','gj','D','d','Dz','dz','E','e','Jo','jo','Zh','zh','Z','z','Z','z','I','i','J','j','J','j','J','j','J','j','J','j','K','k','L','l','Lj','lj','M','m','N','n','Nj','nj','O','o','O','o','P','p','R','r','S','s','S','s','T','t','T','t','Kj','kj','U','u','U','u','U','u','F','f','H','h','C','c','Ch','ch','Dzh','dzh','Sh','sh','Shh','shh','##','#','Y','y','\'\'','\'','Je','je','Ju','ju','Ja','ja');
-
@Ivanko
Thank you, are you sure these signs should be in URL ?
'##','#','\'\'','\'',
Does not look correct for me.
-
@Ivanko
Thank you, are you sure these signs should be in URL ?
'##','#','\'\'','\'',
Does not look correct for me.
Hi it is correct
## - capital letter
# - small letter
'' - capital letter ( backslash is php separator)
' - small letter (same here backslash as php separator)
here is also an example of general translit
https://translit.net/
as array should looks like below
$str = "А а Б б В в Г г Ґ ґ Д д Ђ ђ Е е Ё ё Ж ж З з З́ з́ И и Й й Ѝ ѝ І і Ї ї Ј ј К к Л л Љ љ М м Н н Њ њ О о Ō ō П п Р р С с С́ с́ Т т Ћ ћ Ќ ќ У у Ӯ ӯ Ў ў Ф ф Х х Ц ц Ч ч Џ џ Ш ш Щ щ Ъ ъ Ы ы Ь ь Э э Ю ю Я я";
$str = preg_replace('#\s+#',',',trim($str));
$myArray = explode(',', $str);
$map ="A a B b V v G g Gj gj D d Dz dz E e Jo jo Zh zh Z z Z z I i J j J j J j J j J j K k L l Lj lj M m N n Nj nj O o O o P p R r S s S s T t T t Kj kj U u U u U u F f H h C c Ch ch Dzh dzh Sh sh Shh shh ## # Y y '' ' Je je Ju ju Ja ja";
$map= preg_replace('#\s+#',',',trim($map));
$myArray2 = explode(',', $map);
by the way, you can add in the end this letter є and map je , this letter existing in Ukrainian alphabet ::)
-
@Ivanko
Once again, it's wrong, as objective of whole this is to optimize URL and make it more friendly for search engines, adding ', '', # or ## into URL is WRONG. I am pretty sure that # is completely illegal character in URL as it is used for hash.
Following mapping has been used.
$cyr = array('А','а','Б','б','В','в','Г','г','Ґ','ґ','Д','д','Ђ','ђ','Е','е','Ё','ё','Ж','ж','З','з','З́','з́','И','и','Й','й','Ѝ','ѝ','І','і','Ї','ї','Ј','ј','К','к','Л','л','Љ','љ','М','м','Н','н','Њ','њ','О','о','Ō','ō','П','п','Р','р','С','с','С́','с́','Т','т','Ћ','ћ','Ќ','ќ','У','у','Ӯ','ӯ','Ў','ў','Ф','ф','Х','х','Ц','ц','Ч','ч','Џ','џ','Ш','ш','Щ','щ','Ъ','ъ','Ы','ы','Ь','ь','Э','э','Ю','ю','Я','я');
$lat = array('A','a','B','b','V','v','G','g','Gj','gj','D','d','Dz','dz','E','e','Jo','jo','Zh','zh','Z','z','Z','z','I','i','J','j','J','j','J','j','J','j','J','j','K','k','L','l','Lj','lj','M','m','N','n','Nj','nj','O','o','O','o','P','p','R','r','S','s','S','s','T','t','T','t','Kj','kj','U','u','U','u','U','u','F','f','H','h','C','c','Ch','ch','Dzh','dzh','Sh','sh','Shh','shh','','','Y','y','','','Je','je','Ju','ju','Ja','ja');
That means some characters will be skipped from URL completely.
-
@Ivanko
Once again, it's wrong, as objective of whole this is to optimize URL and make it more friendly for search engines, adding ', '', # or ## into URL is WRONG. I am pretty sure that # is completely illegal character in URL as it is used for hash.
Following mapping has been used.
$cyr = array('А','а','Б','б','В','в','Г','г','Ґ','ґ','Д','д','Ђ','ђ','Е','е','Ё','ё','Ж','ж','З','з','З́','з́','И','и','Й','й','Ѝ','ѝ','І','і','Ї','ї','Ј','ј','К','к','Л','л','Љ','љ','М','м','Н','н','Њ','њ','О','о','Ō','ō','П','п','Р','р','С','с','С́','с́','Т','т','Ћ','ћ','Ќ','ќ','У','у','Ӯ','ӯ','Ў','ў','Ф','ф','Х','х','Ц','ц','Ч','ч','Џ','џ','Ш','ш','Щ','щ','Ъ','ъ','Ы','ы','Ь','ь','Э','э','Ю','ю','Я','я');
$lat = array('A','a','B','b','V','v','G','g','Gj','gj','D','d','Dz','dz','E','e','Jo','jo','Zh','zh','Z','z','Z','z','I','i','J','j','J','j','J','j','J','j','J','j','K','k','L','l','Lj','lj','M','m','N','n','Nj','nj','O','o','O','o','P','p','R','r','S','s','S','s','T','t','T','t','Kj','kj','U','u','U','u','U','u','F','f','H','h','C','c','Ch','ch','Dzh','dzh','Sh','sh','Shh','shh','','','Y','y','','','Je','je','Ju','ju','Ja','ja');
That means some characters will be skipped from URL completely.
OK, somewhere you are right, then lets instead of mapping ## for letter Ъ just use an empty space ''
Capital Ъ = ''
Small ъ = ''
same can be used for
Ь = ''
ь = ''
Probably it will the best solution, I am using it many years.
Finally
// update cyrilic to latin
$cyr = array('А','а','Б','б','В','в','Г','г','Ґ','ґ','Д','д','Ђ','ђ','Е','е','Ё','ё','Ж','ж','З','з','З́','з́','И','и','Й','й','Ѝ','ѝ','І','і','Ї','ї','Ј','ј','К','к','Л','л','Љ','љ','М','м','Н','н','Њ','њ','О','о','Ō','ō','П','п','Р','р','С','с','С́','с́','Т','т','Ћ','ћ','Ќ','ќ','У','у','Ӯ','ӯ','Ў','ў','Ф','ф','Х','х','Ц','ц','Ч','ч','Џ','џ','Ш','ш','Щ','щ','Ъ','ъ','Ы','ы','Ь','ь','Э','э','Ю','ю','Я','я','є');
$lat = array('A','a','B','b','V','v','G','g','Gj','gj','D','d','Dz','dz','E','e','Jo','jo','Zh','zh','Z','z','Z','z','I','i','J','j','J','j','J','j','J','j','J','j','K','k','L','l','Lj','lj','M','m','N','n','Nj','nj','O','o','O','o','P','p','R','r','S','s','S','s','T','t','T','t','Kj','kj','U','u','U','u','U','u','F','f','H','h','C','c','Ch','ch','Dzh','dzh','Sh','sh','Shh','shh','','','Y','y','','','Je','je','Ju','ju','Ja','ja','je');
-
Sounds good, thanks for help ;)