po: add lang_code and lang_name template variables.

master
intrigeri 2011-07-18 16:34:54 +02:00
parent 4ce2490e01
commit f5c8fca887
2 changed files with 10 additions and 0 deletions

View File

@ -343,6 +343,13 @@ sub pagetemplate (@) {
if ($template->query(name => "istranslatable")) { if ($template->query(name => "istranslatable")) {
$template->param(istranslatable => istranslatable($page)); $template->param(istranslatable => istranslatable($page));
} }
my $lang_code = istranslation($page) ? lang($page) : $master_language_code;
if ($template->query(name => "lang_code")) {
$template->param(lang_code => $lang_code);
}
if ($template->query(name => "lang_name")) {
$template->param(lang_name => languagename($lang_code));
}
if ($template->query(name => "HOMEPAGEURL")) { if ($template->query(name => "HOMEPAGEURL")) {
$template->param(homepageurl => homepageurl($page)); $template->param(homepageurl => homepageurl($page));
} }

View File

@ -150,6 +150,9 @@ the wiki homepage.
The `ISTRANSLATION` and `ISTRANSLATABLE` variables can be used to The `ISTRANSLATION` and `ISTRANSLATABLE` variables can be used to
display things only on translatable or translation pages. display things only on translatable or translation pages.
The `LANG_CODE` and `LANG_NAME` variables can respectively be used to
display the current page's language code and pretty name.
### Display page's versions in other languages ### Display page's versions in other languages
The `OTHERLANGUAGES` loop provides ways to display other languages' The `OTHERLANGUAGES` loop provides ways to display other languages'