MultiLanguageViews-Talk

Summary: Talk page for MultiLanguageViews.
Maintainer: HansB
Users: +3 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

Dinalogic 2010-07-18: I made a little modification (only 3 lines of code) for basic styling of language selector, so you can introduce a custom separator between consecutive labels. On the MLVSelectLangMarkup function, add this before the foreach ($plang as $k) loop:

  $sep="";

Inside the loop, modify the last line:

  $out .= $sep.str_replace('$page', $pagename, $str).' ';

and add a new line:

  $sep=$args['sep'];

With this, you can use the "sep" variable when putting the language selector in your template for defining a html separator. For instance, with

  (:selectlang lang=en,es sep= |  :)

you'll get something like english | espanol as the language selector. Would you consider to add this little enhancement to the next release?

   Done. Please use the >= 2015-10-09 release.

Antony Templier 2010-09-23:I found a bug.

If you use

 (:selectlang flag:) 

used in Site/SideBar page, and you choose a page on the wiki in which there is no translation ( i mean no tag (:if lang <id>:) ), then this

 Attach:Site/Site/.png"" 

is displayed in the menu.

Workaround : To be sure nothing appends when there is no translation, I add a extra condition in the function MLVSelectLangMarkup just before the loop foreach ($plang as $k) at line 171 of the langview.php file.

 
        if(count($plang)>1){
	    foreach ($plang as $k) {
		    $str = '';
		    $str = str_replace('$id', $k, $MLVLinkPatterns[$type]);
		    $str = str_replace('$label', $MLVList[$k], $str);
		    $out .= str_replace('$page', $pagename, $str).' ';
	    }
	}
 

   Done. Please use the >= 2015-10-09 release.

Damien November 23, 2010, at 02:40 PM Thanks, I am happy yo use this recipe. But it is unclear where I should place the flag images, as this syntax does not look as standard. I can probably replace it with Site./$id.png, but then it is more a problem to install an update.

Damien November 23, 2010, at 02:48 PM Upon testing I see that both syntaxes are equivalent Site./$id.png and Site/Site/$id.png


Sorse - 2011-09-20: I found a bug.

When using multiple wiki interface languages, defined with

if ($_COOKIE[$MLVCookie] == 'de') {
  XLPage('de','PmWikiDe.XLPage');
  XLPage('de','PmWikiDe.XLPageCookbook');
}

etc. for other language's XL pages

the language of header/footer changes only after a second click on the language switch. It has to do with the way changes in cookies are reflected.

The solution is similar to the one given for the MultiLanguage recipe: edit langviews.php around line 74

        if (@$MLVList[$sl]) {
  	if (!isset($_GET['lang'])) setcookie($MLVCookie,$sl,$MLVCookieExpires,'/');
  	$Lang = $sl; unset($sl);
  } else $Lang = $MLVDefault;
  $_COOKIE[$MLVCookie]=$Lang; # add this line

};

   Done. Please use the >= 2015-10-09 release.

Language specific skins pictures

To make some pictures of a skin language specific simply

  1. create image specific pictures e.g. drag_arrow_en.png and drag_arrow_ar.png in pub/
  2. edit your skin to reflect language support by adding {$Lang} where required e.g. <img src="$ScriptUrl/pub/drag_arrow_{$Lang}.png"/>

Johan Bengtsson - 2015-12-02: Problems with default language.

I tried using $MLVDefault to set the default language. Unfortunately it seems that the browser default language overrides this setting. I'm in Sweden so we want the default language to be sv, but all our computers are installed with english language software/OS. I fixed the problem by deleting:

else if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
        $sl = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);

from langviews.php. But it would be nice to have be able to set this through a variable in config.php.


Johan Bengtsson - 2018-02-28: Bugfix not included in latest release.

The bugfix from sorse above (2011-09-20) was not included in the latest release it seems...

Talk page for the MultiLanguageViews recipe (users).