-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Inflector::transliterate to public #10061
Comments
Do you want transliteration only? There's |
Yes, slug can be use to normalize the filename and url. However in some language (mine is Vietnamese) the meta-data or meta-keywords also should be transliterate for better SEO. Another use case is to generate Ascii equivalent version of name or contents. This is where transliteration come in handy. Does it make sense? |
Better SEO w/ transliterated content? Are you absolutely sure? Overall I agree that there could be cases. |
I'm not a SEO expert so I am not sure about the effective of transliteration keywords. However many websites in Vietnam include both transliterated and original keywords meta in the header. There also some resources mention this and I believe search engine got index on transliterated content easier (more similar to English?). https://moz.com/blog/so-you-want-to-know-about-foreign-language-seo-mozinar-q-a For my recent project, I use it to convert SMS content. It is one of use case I think. |
SMS content is definitely a good use case. |
'עִבְרִית' => 'iberiyt',
'недвижимость' => 'nedvizimost', When we make 'ʻibĕriyţ'
'nedvižimostʹ' I can say about Russian word "недвижимость" that we don't use diacritics in transliteration. Therefore we usually write Is it an expected behavior? |
Found a solution that can be turned optionally.
NFKD is an option of forms normalization described on unicode consorcium website So let's test different common options: $s = `获取到后台数据后 Український транслит на PHP! ¿Недвижимость или עִבְרִית?`;
$transliterators = ['Any-Latin; NFKD', 'Any-Latin; Latin-ASCII', 'Any-Latin; NFKD; [\u0080-\u7fff] remove'];
foreach ($transliterators as $transliterator) {
echo "<br>" . transliterator_transliterate($transliterator, $string);
}
The most spelling-correct is no.1, but the safest is no. 3. Your thoughts? |
We should make it an option. |
It's already an option of |
Yes. |
Probably. |
It's a good idea. |
Yes. |
I'll handle this. Wait for the PR |
In order to support transliteration, I have to install another composer module (yii2-transliteration) to do so.
Just found that simple conversion can be made with our transliterate.
Why don't we change
protected
topublic static transliterate
instead? It quite convenient some time.Thanks,
The text was updated successfully, but these errors were encountered: