Hi @austeroid: in theory, your solution should work, but it is not how qTranslate is meant to be used. If it does not work, then it is most likely because your get_language_code() does not return what it is supposed to return, or the output is compared to a wrong thing, like en instead of EN.
Here is a solution “by design”:
<section class="hero home">
<h1><?php _e('<!--:en-->Only show if selected language is EN<!--:--><!--:de-->Only show if selected language is DE<!--:-->'); ?></h1>
</section>
Hi John,
Thank you for your reply, i tried get_language_code() and WordPress doesn’t recognise it as a legit function.
So how would you separate the two homepages in 2 different languages? At the moment, on my homepage, there are hardcoded elements that are shared between the two. For example I will have 2 gallery sliders. Each one will contain each of their own slides in 2 languages.
The code to output the slide show is
<section>
<?php echo do_shortcode( '[new_royalslider id="1"]' ) ?> <!-- Slide show in english -->
<?php echo do_shortcode( '[new_royalslider id="2"]' ) ?> <!-- Slide show in german -->
</section>
I tried
<?php
<!--:en-->
echo do_shortcode( '[new_royalslider id="1"]' )
<!--:-->
<!--:vi-->
echo do_shortcode( '[new_royalslider id="2"]' )
<!--:-->
?>
but doesn’t work.
What are your thoughts on this? technically is there a way to have two different templates for 2 different languages?
Regards,
Austin.
Normally, you would not need two templates. A template read the data from a page/post and you customize the data per language in a normal way using shortcodes with different arguments and different text. This normally is not done in the code, but rather in the editor of pages, which use the template.
Does it make sense for your case?
I do not think this would solve @austeroid’s problem because I’m facing same problem here. I want to embed extra font css for my Burmese (Myanmar) page. My English page use some beautiful English web font so I can’t set all <body> tag to Myanmar font.
Since Myanmar font is not compatible with all computer yet, I have to embed Myanmar font for Burmese pages.
How can I embed css for specific language? How can I translate widget for different languages?
You saved my life @darkseal.
Your code worked perfectly =)