Considered alphabets are as follow (not all will works, but the most important and common yes) and the function can:
detect and return the type of the alphabet in $text
OR
return transliterated $text from an alphabet to any another
Code: Select all
# https://www.regular-expressions.info/unicode.html // Unicode Scripts
# Human writing systems switches Test function - axew3.com
#$text = 'ڳاڙهو چنڊ'; # Arabic
#$text = '红月亮'; # Chinese (Hans): do not work transliterating into chinese some other language. Works transliterating from chinese to others (almost all others that works!)
#$text = 'двойняшки'; # Cirillic
#$text = "Well, Latin text it's the only one i know!";
# Note: Han (Chinese) transliteration (Any-Hans transliterator ID)) and SOME OTHER lang alphabet will not work: it maybe require different ids for the transliteration (not tested all, anyway the most important works fine)
# The function return false if there is no transliteration result
# Note:
# The ' $tolang ' param expect the Language name into one of these formats/names (CaseSensitive):
# Arabic,Armenian,Bengali,Bopomofo,Braille,Buhid,Canadian_Aboriginal,Cherokee,Cyrillic,Devanagari,Ethiopic,Georgian,Greek,Gujarati,Gurmukhi,Han,Hangul,Hanunoo,Hebrew,Hiragana,Inherited,Kannada,Katakana,Khmer,Lao,Latin,Limbu,Malayalam,Mongolian,Myanmar,Ogham,Oriya,Runic,Sinhala,Syriac,Tagalog,Tagbanwa,TaiLe,Tamil,Telugu,Thaana,Thai,Tibetan,Yi
# any passed text is converted/transliterated to LATIN ASCII then transliterated again to the required Language (one of the above) using again transliterator_transliterate
//$test = w3all_detect_convert_language($text, $toLang = 'Arabic');
//$test = w3all_detect_convert_language($text, $toLang = '', $returnDetectLang = true);
# C 2024 axew3.com
function w3all_detect_convert_language($text, $toLang = '', $returnDetectLang = false)
{
....
....
Code: Select all
Arabic,Armenian,Bengali,Bopomofo,Braille,Buhid,Canadian_Aboriginal,Cherokee,Cyrillic,Devanagari,Ethiopic,Georgian,Greek,Gujarati,Gurmukhi,Han,Hangul,Hanunoo,Hebrew,Hiragana,Inherited,Kannada,Katakana,Khmer,Lao,Latin,Limbu,Malayalam,Mongolian,Myanmar,Ogham,Oriya,Runic,Sinhala,Syriac,Tagalog,Tagbanwa,TaiLe,Tamil,Telugu,Thaana,Thai,Tibetan,Yi