[pmwiki-users] Find what language is being used from a skin

sti at pooq.com sti at pooq.com
Tue Oct 9 19:58:48 CDT 2007


carlos.ab at gmail.com wrote:
> Hi,
> 
> I want to set a Page Variable inside my skin , so when this line shows up ...
> 
> <html xmlns='http://www.w3.org/1999/xhtml'  xml:lang='$Lang' lang='$Lang'>
> 
> The variable will be replaced by the language that was set in config.php:
> 
> XLPage('fr',"$SiteGroup.Traduction");
> 
> I searched for it, tried a few things with $XL, $XLLangs but no success so far 
> so...
> 
Well, just because XLPage() was called with 'fr' is no guarantee that its the
language in use. Many recipes use the XLPage() function to load their
parameters into a fake 'language' by calling something like:

  XLPage('foo-recipe',"$SiteGroup.FooRecipe);

So, there's really nothing you can do to look at the contents of $XL and
$XLLangs and tell the languages from the recipes.

Instead, you'll have to invent a new parameter like $SkinLang and use that. In
config.php, the user would set

  $SkinLang='fr';

And in you skin.php you'd say something like:

  global $SkinLang;
  SDV($SkinLang,'en'); # default if not set by user.
  $FmtPV['$SkinLang']  = '$GLOBALS["SkinLang"]';

Finally, you'd use $SkinLang in your template:

  <html xmlns='http://www.w3.org/1999/xhtml'  xml:lang='$SkinLang'
lang='$SkinLang'>




More information about the pmwiki-users mailing list