Translating the homepage.
November 15, 2013 at 6:40 pm #11191
Tonight I have a party, so cannot work on it.
Can you give me the language switch code to change language, I notice it in your header. The instructions on the plugins site are not very clear.
Btw, because I use WP in my native language I did not know page Extra is called Tools in English WP. Sorry.
GuidoNovember 15, 2013 at 6:44 pm #11192
Oh! No worries dude. Do what you gotta do 🙂 I appreciate all the help so far anyways.
And it’s very basic, as long as you’re using it as a wordpress plugin, really. Once you install the plugin, just set a few languages within the settings page ” Settings ->Language Switcher”
And the ISO code is just set to EN for english and FR for french, and then it’s just shortcode driven from within a page / post by doing it as follows:
[lang_en]English text goes here[/lang_en][lang_fr] French text goes here[/lang_fr]
I hope that clears up some confusion…
ChrisNovember 15, 2013 at 6:47 pm #11193
I mean the header code, on top of your site. To change the site language from ENG to French… Without that I am not able to test my site.
GuidoNovember 15, 2013 at 6:59 pm #11194
Does this help you ?
langswitch_list_langs(false, true, ‘li’);
</div>November 15, 2013 at 7:14 pm #11195
Does not work here. I guess you can reach your server via FTP? Because I will create a sample po/mo file which you can upload to your SimpleCorp ‘languages’ folder to find out if this works.
Btw, if you add code, please use the code button.
GuidoNovember 15, 2013 at 7:16 pm #11196
I can indeed access my sever via FTP client, I will definitely try to upload the po/mo file to see if it works.November 15, 2013 at 7:28 pm #11197
Unzip it and upload the 2 files to SimpleCorp > languages (folder)
I’ve only translated the Read More (displayed on homepage)
GuidoNovember 15, 2013 at 7:41 pm #11198
I’ll give it a shot now, should I put it in the original theme ? or will it work fine in my child theme ? ( I’ve copied the “language” folder )
Thanks Guido.November 15, 2013 at 7:49 pm #11199
Please try both folders.
I hope it works, otherwise I give up and you should think about using another plugin..
GuidoNovember 15, 2013 at 8:28 pm #11200
Crap… Doesn’t appear to work. I placed the 2 files in both language folders, and the text still reads “read more” in english…
Using another plugin, although a possibility, would not be a favorable solution, as I’ve spent a lot of time entering and formatting content with the current plugin.
I may have to bite the bullet and try my luck with another one though..
I’m still kind of hoping i can get it to work through my current configuration though, where the homepage is generated by using a page template on a static “home” page. And I enter the content through the template file itself, splitting the content into [lang_en] and [lang_fr] on the template itself.
Now if I could only figure out how to get the template files to recognize the shortcode, instead of displaying it as text.
DO you have any insight on that ?
Thanks again for everything, Guido. I appreciate your help in this matter.November 16, 2013 at 1:53 am #11204
Too bad man! Apparently your plugin only supports the content and excerpt (so a post or a page).
I have a question, is it very important the 404 and searchpage are translated too?
If not and you still want to use your own plugin we can change homepage to a static page. We can work with columns so your 4 boxes will be (almost) the same.
GuidoNovember 16, 2013 at 2:15 am #11205
The static page is actually a very good idea.
With the theme’s shortcodes I (or you) can create columns like the homepage has.
I already created a pagetemplate with the slider on top, so you can create a static homepage and select ‘my’ homepage template on the right.
Now you can add the text in 2 languages like you always do.
GuidoNovember 16, 2013 at 2:36 am #11206
That’s a shame. Well thanks for helping 🙂
And it’s not crucial that the 404 and search page are translated, I would like that they were, but the homepage is the focus.
I have already set up a page template that’s a copy of my homepage, but I can’t get the [lang] tags to be recognized in the template .php file. I have tried using:
<?php echo do_shortcode(“[lang_en]“); ?>
And it still wasn’t recognized, and upon contacting the Language Switcher’s author, she said the following:
If your theme is doing something other than WordPress standard to create the home page, then you would need to pass whatever text it is trying to display through the same PHP function that the plugin uses to filter text.
Hopefully you’re a PHP programmer and can figure out how to do that within your theme. The function you would want to call is probably langswitch_filter_langs(), which is in the plugin’s langswitch.php file.
So instead of the do_shortcode(‘the text goes here’) that you are trying, you probably want langswitch_filter_langs(‘the text goes here’).
But I can’t quite figure out how to work that…November 16, 2013 at 12:44 pm #11211
I have created a homepage template containing the slider and the homepage blurp:
So this is a static page, you can add your content like on ‘normal’ page. With theme shortcodes I have created 2 columns for displaying homeboxes.
Because this is a ‘normal’ page you are able to add the plugin lang codes and I’m almost certain this will work, because it does at my server!
GuidoNovember 16, 2013 at 3:20 pm #11213
Nice, that looks pretty much perfect.
How can I get that file and work it into my own sites?
Thanks again Guido.
You must be logged in to reply to this topic.