November 13, 2020 at 2:07 am #8409
There is a problem with strip_desc in Chinese and Korean languages. They have sentences without spaces. It would be better to trim not words, but symbols. There is no spaces here and it’s correct.
你是否注意过每天在我们城市工作的环卫工人？他们几点钟起床，几点钟下班？一个环卫工人每天需要捡多少垃圾？这个视频带你体验环卫工人一天的日常November 13, 2020 at 11:55 am #8415
Super RSS Reader already uses
wp_trim_wordsto trim text of any language. Please see link below.
wp_trim_wordstrims even if the language uses single character as a word. See description below.
This function is localized. For languages that count ‘words’ by the individual character (such as East Asian languages), the $num_words argument will apply to the number of individual characters.
I do not understand east asian languages. Please give an example on what your are expecting. That would be helpful.
AakashNovember 13, 2020 at 3:17 pm #8417
As you have mentioned in the comments below
It’s not working with these languages. In these examples there is no spaces or a few of them. That’s why the plugin counts it as 1 word:
Thai language: 2 spaces, and 3 words as your plugin counts it.
บทสัมภาษณ์ระหว่างนักแสดงชายที่พึ่งสูญเสียเพื่อน กับหนึ่งในอาสมัครจากองค์กรสะมาริตันส์ที่ให้บริการทางด้านให้การปรึกษา และเชื่อว่าการฟังด้วยใจจะช่วยทั้งตนเองและผู้อื่น
It’s better to trim by characters and add this ability in the shortcode.
As I understand, in your case if strip desc is set to 50 then the content is more right ? You want it to be shorter as in some languages 1 word is longer.
In that case, can you please set strip desc to 3 or 4 ? so that the description length is smaller.
Please correct me if I misunderstood.
AakashNovember 13, 2020 at 3:37 pm #8418
I do it, setting 3 words, but sometimes sentences contain 1 long word.
I can’t reply here because the site doesn’t save the messages.November 13, 2020 at 4:34 pm #8419
Your posts are caught as spam. Thats the reason.
Anyways, you can try the change below.
In feed.php, find and replace
$desc = wp_trim_words( $desc, $strip_desc );
$desc = mb_substr( $desc, 0, $strip_desc, "utf-8" );
AakashNovember 13, 2020 at 4:43 pm #8420
Please, explain, what does this code do?November 13, 2020 at 6:08 pm #8421
It will trim the desciption by characters and not by words.November 13, 2020 at 7:52 pm #8422
that’s working.thank you for you help!November 13, 2020 at 8:28 pm #8423
- The topic ‘strip_desc for Chinese and Korean languages’ is closed to new replies.