Home page and options translation
Home › Forums › Free Theme Support › Asteria Lite › Home page and options translation
-
#73172
Lumiere de Lune
On December 10, 2013 at 12:17 pmActually, I thought I had posted it, but the question is : how do I translate the homepage and other options, when I have a multilingual website ? They don’t appear in the string translation page of WPML (which is the most used WP Plugin for multilingual websites)
#73267On December 10, 2013 at 6:50 pmYes I saw that while developing the theme, I followed the instruction that they described in their documentation, but strangely none worked.
You can translate your strings using shortcodes, First add this to your functions.php
http://pastebin.com/5WSeiK33and then add your shortcodes like this from your theme options page:
[wpml_translate lang="en"]Your English Text Here...[/wpml_translate]
#89216
Aldo
On January 31, 2014 at 9:16 amHoi,
I’m using mqTranslate to translate.
Is there a possible way to translate the homepage with this?Kind regards,
Aldo#89219On January 31, 2014 at 9:20 amyou can if they have shortcode support. do they have shortcodes?
#89223
Aldo
On January 31, 2014 at 9:40 amThnx for the quick response.
I don’t know for mqTranslate, but qTranslate has shortcodes 🙂
example:
[:en] English text [:de] Deutsch text [:off] Text for all languagesPS: Thanks for Asteria
#89234On January 31, 2014 at 10:04 amcan you try this shortcode in the “welcome text” field from the theme options page and see if works?
#91373
Aldo
On February 5, 2014 at 5:53 pmFound a little problem trying to get all languages after an shortcode.
But found a solution:
<!--:en-->English text<!--:--><!--:de-->Deutsch text<!--:--><!--:hu-->Hungarian text<strong><!--:--></strong>All language text
My “welcome text” field is currently
<!-- Intro --> [:nl] <h2>Welkom op de officiële website van Jolien De Gendt</h2> <p>Kies een andere taal:</p> [:en] <h2>[:en]Welcome to the official website of Jolien De Gendt</h2> <p>Choose a language:</p> [:fr] <h2>Bienvenue sur le site officiel de Jolien De Gendt</h2> <p>Choisissez une langue: </p> [:ja] <h2>JolienデGendtの公式サイトへようこそ</h2> <p>言語の選択:</p> [:de] <h2>Willkommen auf der offiziellen Website von Jolien De Gendt</h2> <p>Wählen Sie eine Sprache:</p> [:es] <h2>Bienvenido a la página oficial de Jolien De Gendt </h2> <p>Elija un idioma: </p> <!--:--> <a href="http://www.joliendegendt.be/_preview/nl" title="Nederlands">Nederlands</a> | <a href="http://www.joliendegendt.be/_preview/fr" title="Français">Français</a> | <a href="http://www.joliendegendt.be/_preview/en" title="English">English</a> | <a href="http://www.joliendegendt.be/_preview/de" title="Deutsch">Deutsch</a> | <a href="http://www.joliendegendt.be/_preview/ja" title="日本語">日本語</a> | <a href="http://www.joliendegendt.be/_preview/es" title="Español">Español</a>
#91461On February 5, 2014 at 10:45 pmhow is this displayed on the frontend?
and can you check if there is “do_shortcode” text in your content-welcome-text.php file?
#91622
Aldo
On February 6, 2014 at 4:09 pm
English:
Welcome to the official website of Jolien De GendtChoose a language:
Nederlands | Français | English | Deutsch | 日本語 | EspañolFrançais
Bienvenue sur le site officiel de Jolien De GendtChoisissez une langue:
Nederlands | Français | English | Deutsch | 日本語 | Español<hr/>
This is the full code of the content-welcome-text.php
<?php global $asteria;?> <?php $welcome = $asteria['home_sort_id']; if(!empty($welcome['welcome-text'])){ ?> <!--Text Block START--> <?php if ( asteria_is_mobile() && (!empty($asteria['hide_mob_welcm'])) ) { ?> <?php }else{ ?> <div class="text_block"> <div class="text_block_wrap"><div class="center"><?php echo do_shortcode($asteria['welcm_textarea_id']); ?></div></div> </div> <?php } ?> <!--Text Block END--> <?php } ?>
There is a do_shortcode on line 7
<?php echo do_shortcode($asteria['welcm_textarea_id']); ?>
PS: Can’t you show a preview of the text you post on this forum?
Or change it afterwards?#92284On February 7, 2014 at 9:20 pmJust checked your site. the Shortcode works great I see..
#95831
Cecilia
On February 20, 2014 at 2:02 pmI’ve try to add this http://pastebin.com/5WSeiK33 in functions.php but there is a parse error in line 21 in this code, can you help me?
Thank you#97450On February 23, 2014 at 6:51 pm@Cecilia open up functions.php and add this:
/***WPML Translation Shortcode****/ if(! function_exists('wpex_wpml_lang_translate')) { function wpex_wpml_lang_translate( $atts, $content = null ) { extract(shortcode_atts(array( 'lang' => '', ), $atts)); $current_lang = ICL_LANGUAGE_CODE; //get WPL current language if($lang == $current_lang){ return do_shortcode($content); } } add_shortcode('wpml_translate', 'wpex_wpml_lang_translate'); }
after this:
add_action( 'pre_get_posts', 'asteria_home_query' );
#98413
Cecilia
On February 26, 2014 at 10:29 amThank you!
Unfortunately continues to report an error. Parse error: syntax error, unexpected T_RETURN in /var/www/virtual/nomesito/htdocs/wordpress/wp-content/themes/asteria-lite/functions.php on line 30I tried also to insert it in an editor (dreamweaver) and also reports the error. You will find the image of the screen here: https://www.dropbox.com/s/ik815wwy73k4677/code.jpg
#98472On February 26, 2014 at 2:38 pmcopy all the code of your fucntions.php after adding the code and paste it in a pastebin.com page and share it here.
#99765On March 2, 2014 at 8:48 amthere is a sytanx error in the code. a bracket was missing. try this:
/***WPML Translation Shortcode****/ if(! function_exists('wpex_wpml_lang_translate')) { function wpex_wpml_lang_translate( $atts, $content = null ) { extract(shortcode_atts(array( 'lang' => '', ), $atts)); $current_lang = ICL_LANGUAGE_CODE; //get WPL current language if($lang == $current_lang){ return do_shortcode($content); } } add_shortcode('wpml_translate', 'wpex_wpml_lang_translate'); }
#100072
Cecilia
On March 3, 2014 at 10:02 amThank you. Now there isn’t syntax errors, I can save “functions.php” without problems. But i tried to add your shortcodes like this:
[wpml_language language=”en”]Your English Text Here…[/wpml_language] in the welcome text and doesn’t work. Can you help me?
Thanks in advance the theme is very cute.#100323On March 3, 2014 at 10:32 pmdoes your content-welcome-text.php contains this:
<?php echo do_shortcode($asteria['welcm_textarea_id']); ?>
#100482
Cecilia
On March 4, 2014 at 12:04 pmYes, there is.
But the shortcode like this [wpml_language language=”en”]Your English Text Here…[/wpml_language] doesn’t work.
I see the same code in the front end.
Thank you.#100591On March 4, 2014 at 6:33 pmare you adding the code in text mode or html mode? try in both modes and see if that worked…
#102801
Isis
On March 10, 2014 at 2:28 amHi Towfiq,
I made a website in two different languages using the Polylang plugin. How can I make two different homepages (one in English and one in Spanish) using your theme?
Kind regards,
Isis
#102858On March 10, 2014 at 6:47 am@Cecilia send me your site’s id/pass through this page:
I will look into it when I have some time.
@Isis whats your site address?
#105437
Cecilia
On March 14, 2014 at 3:39 pmThank you, I sent you an email with site’s id / pass and address.
Tagged: translation WPML
The topic ‘Home page and options translation’ is closed to new replies.