Functions for Developers and Template Authors

Having Problems? Need Help? Post here!

Functions for Developers and Template Authors

Postby Qian Qin » Fri Jun 20, 2008 1:35 pm

Returns translated string, which will be first parsed by qTranslate and then by Gettext
Code: Select all
__(string $str)

returns nothing, echos translated string, which will be first parsed by qTranslate and then by Gettext
Code: Select all
_e(string $str)

returns currently selected language.
Code: Select all
qtrans_getLanguage()

returns formatted time using strftime syntax format. Use %q for date suffix (th, st, nd, rd)
Code: Select all
qtrans_strftime(string $format, int $date)

returns an converted URL for the selected language or the current language, if $lang is omitted.
Code: Select all
qtrans_convertURL(string $url, string $lang)

returns nothing, generates HTML lanuage selection code for the current page. $style can be either image, text, both or dropdown.
Code: Select all
qtrans_generateLanguageSelectCode(string $style, string $id)


if you want to show content only for a specific language, use something like this
Code: Select all
<?php _e("[:en]English only"); ?>

if you even want to use HTML code and PHP Code, you can use something like this
Code: Select all
<?php if(qtrans_getLanguage()=='en'): ?>
<img src="<?php echo $imgsrc; ?>" alt="English Image" />
<?php endif; ?>
Qian Qin
Site Admin
 
Posts: 891
Joined: Thu Jun 19, 2008 12:14 pm
Location: Germany

Return to qTranslate Support Forum

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 5 guests