[Resolved] [Plugin: 012 Ps Multi Languages] Howto make Excerpts multi language compatible
Is it possible to make this plugin compatible with my excerpts or recap.
When i switch language my excerpts dont change with it, only my title.
Can someone help me out.
I gave it a shot and added multi-language support for excerpts by modifying the following files:
The only caveat is that the excerpt fields for supported languages does not honour the show/hide excerpt checkbox – they always display.
I tested multilingual excerpts by entering excerpt text in multiple languages, and adding snippets to the home page of my test site. The excerpts display in the selected language.
Backup the current version of your code, and replace the files with these:
To be safe, you should temporarily deactivate the plug-in, replace the files, and reactivate the plugin. If you update your version of the plugin, you will have to re-apply the changes to the new version.
Please let me know if this works for you.
I checked the script but there are some small bugs.
I get Fatal error: Call to undefined function url_exists() in /home/…/public_html/wp-content/plugins/012-ps-multi-languages/ps-multi-languages.php on line 886
Fatal error: Call to undefined function url_exists() in /home/…/public_html/wp-content/plugins/012-ps-multi-languages/ps-multi-languages.php on line 895
when i enter the dashboard.
Those two issues i managed to fix on line 886 and 895 by changing
if ( url_exists( $flag_icon )
if ( ps_url_exists( $flag_icon )
The excerpts works now but when i enter the blogdescription it jumps back to the default description.
If you can fix the last part it would be great.
I think I found the source of the ‘bugs’ you found, and cleared up something I was confused by.
The author of the plug-in updated the source files, but did not update the revision number! The current source files have a datestamp of ‘2012-10-03 9:39AM’, while the source files that I have have a datestamp of ‘2012-09-30 4:12PM’ – and there are a few changes. If the author of the plugin is reading this – PLEASE UPDATE YOUR VERSION NUMBER WHEN YOU UPDATE SOURCE FILES!! ソースファイルを更新するときに、バージョン番号を更新してください！
So, from my diff, here are all the changes between the files:
You found two of the changes: lines 855 and 864 of ps-multi-languages.php (change ‘url_exists’ to ‘ps_url_exists’), and
Two changes within functions.php: lines 19 and 67 : change the $echo parameter to ps_012_multilingual_list from false to true (19), and change the function name from url_exists to ps_url_exists.
Here’s an updated version of ps-multi-languages.php
If someone downloads and updates the new function.php, the previous flag code I posted won’t work, since calling the function will return the flag html snippet, which is what I think the author originally intended. In this case, your change to function.php to display the flags will do the trick.
Here’s an updated version of functions.php with the flag code included, reverse and highlighted. Users will have to remove the php code in their header to display the flags, but leave the following line:
<?php if ( function_exists( 'ps_012_multilingual_list' ) ) $gs = ps_012_multilingual_list() ; ?>
Finally, to answer your question, I re-applied my changes to the ‘new’ version of ps-multi-languages.php, and it seems to work just fine. I updated the tagline for all of my supported languages, and the changes appeared on the test site. Did you change any other code in any function? Maybe I’m misinterpreting what you mean by blogdescription? Please let me know.
The updated versions works great and the excerpts changes correctly. But what i mentioned is the following:
My default language is Dutch.
If i change the language to English, it also works correctly, and everything is translated to English.
As soon i navigate to another page or post, it automaticly changes back to my default language Dutch.
It would be nice if i select a language and it stays in the selected language.
That is strange! Did you install the
setlocaleplug-in as per my post here?
I just verified that my test site maintain the language selection between pages/posts/sessions, and I really didn’t do anything other than install the setlocale plugin. If you installed & activated the plug-in and are still having issues, please follow-up.
Are your URLs being re-written with the selected language on the end?
Mine doesn’t show any URL suffix in initially entering the site, but every link after that results in the suffix in the selected language being added. Could another plugin be interfering with this behaviour?
You’re right, it works perfectly now. Even without the Setlocale plug-in.
I don’t know exactly what the problem was but in my test environment the language changes back to default but on my live site it works perfectly. Probably there are settings or permissions different on my test site, i’ll check it later someday.
BTW, many thanks. You’re the best
- The topic ‘[Resolved] [Plugin: 012 Ps Multi Languages] Howto make Excerpts multi language compatible’ is closed to new replies.