DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:multilingual

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:multilingual [2013-07-07 22:19] – [Requests/Issues] 124.110.12.173plugin:multilingual [2023-10-30 23:09] (current) Klap-in
Line 6: Line 6:
 email      : d.stonier@gmail.com email      : d.stonier@gmail.com
 type       : syntax,action type       : syntax,action
-lastupdate : 2012-01-29 +lastupdate : 2020-12-15 
-compatible : 2008-05-052011-11-10+compatible : GreeboHogfather
 depends    :  depends    : 
 conflicts  : translation conflicts  : translation
 similar    : translation similar    : translation
-tags       : language +tags       : language, translation 
-downloadurl: http://snorriheim.dnsdojo.com/redmine/attachments/download/29/multilingual-1.0.1.tar.gz +downloadurl: https://github.com/stonier/dokuwiki_plugins/raw/master/releases/multilingual-1.0.2.tar.gz 
-sourcerepo : http://snorriheim.dnsdojo.com/redmine/repositories/show/multilingual +sourcerepo : https://github.com/stonier/dokuwiki_plugins/tree/master/multilingual 
-bugtracker : http://snorriheim.dnsdojo.com/redmine/projects/multilingual/issues+bugtracker : https://github.com/stonier/dokuwiki_plugins/issues
 ---- ----
  
 This plugin tries to collect and improve on a few multilingual plugins and tips that are floating around and collate them into a single plugin that provides a consistent interface for multilingual capabilities. This plugin tries to collect and improve on a few multilingual plugins and tips that are floating around and collate them into a single plugin that provides a consistent interface for multilingual capabilities.
  
-===== Links ===== 
  
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/multilingual/|Home Page]] +===== Installation ===== 
-  * [[http://snorriheim.dnsdojo.com/doku/doku.php/en:cooking:cooking|Demo]] + 
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/multilingual/Installation|Installation]] +Download and install the plugin using the Plugin Manager using the following url
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/multilingual/Configuration|Configuration]]  + 
-  * [[http://snorriheim.dnsdojo.com/redmine/projects/multilingual/boards|Forum]]+https://github.com/stonier/dokuwiki_plugins/raw/master/releases/multilingual-1.0.2.tar.gz 
 + 
 +Use the plugin manager, or alternatively, just download and install into the doku/lib/plugins directory.
  
 ===== Configuration ===== ===== Configuration =====
Line 32: Line 33:
  
 ===Template=== ===Template===
 +
 Without hacking your template too much, the cleanest way is to create a file in your template directory called ''/lib/tpl/_template_/show_languages.html'' Without hacking your template too much, the cleanest way is to create a file in your template directory called ''/lib/tpl/_template_/show_languages.html''
 <code php show_languages.html> <code php show_languages.html>
Line 50: Line 52:
  
 ===Configuration Manager=== ===Configuration Manager===
 +
 As admin, under the configuration settings page, there are some important configuration settings that are necessary to be configured before proceeding: As admin, under the configuration settings page, there are some important configuration settings that are necessary to be configured before proceeding:
  
Line 66: Line 69:
 == Root Page Redirection == == Root Page Redirection ==
  
-Also, I figured I wanted the user to be redirected to a language page instead of page not found when visiting the top site without explicitly specifying the language namespace. (ex : http://my.org/wiki/doku.php) The following code (should go before 'return true' in 'multilingual_ui') will look for browser preference language first and then list of enabled languages in this plugin and check if any of the language page exists and if it does, redirects there. This only redirects the top page, since it's hard to determine if the initial part of the namespace of other pages refers to a language or not. (Maybe unless it goes through the list of ISO codes.) But then again, other pages should be linked with language preference prepended. (This does not honor the RFC for 'Location' header by not being an absolute URL, but browsers do handle these anyway...)+Also, I figured I wanted the user to be redirected to a language page instead of page not found when visiting the top site without explicitly specifying the language namespace. (ex : http://my.org/wiki/doku.php) The following code (should go before 'return true' in 'multilingual_ui' within 'action.php' of this plugin) will look for browser preference language first and then list of enabled languages in this plugin and check if any of the language page exists and if it does, redirects there. This only redirects the top page, since it's hard to determine if the initial part of the namespace of other pages refers to a language or not. (Maybe unless it goes through the list of ISO codes.) But then again, other pages should be linked with language preference prepended. (This does not honor the RFC for 'Location' header by not being an absolute URL, but browsers do handle these anyway...)
  
 <code php> <code php>
Line 96: Line 99:
 </code> </code>
  
-Also interface language could be switched to a different one from the document's (if browser preference is in Japanese, but the content is in English, it will show the interface in Japanese, which looks odd) but by adding the following line in 'function multilingual_ui', it keeps the languages of interface and the content in sync.+Also interface language could be switched to a different one from the document's (if browser preference is in Japanese, but the content is in English, it will show the interface in Japanese, which looks odd) but by adding the following line in 'function multilingual_ui' in 'action.php' of this plugin, it keeps the languages of interface and the content in sync.
  
 <code> <code>
-array_unshift($languages, preg_replace('/^([\w\-]+):.+$/', '\1', $ID));+array_unshift($languages, preg_replace('/^([\w\-]+):.+/', '\1', $ID));
 </code> </code>
  
Line 113: Line 116:
 </code> </code>
  
-A note to developer but there is a small bug in 'function multilingual_ui' in 1.0.1 in this line of 'function multilingual_ui',+A note to developer but there is a small bug in 'function multilingual_ui' in 1.0.1 in this line,
 <code> <code>
 $languages = preg_split("/,/", preg_replace('/\(;q=\d+\.\d+\)/i', '', getenv('HTTP_ACCEPT_LANGUAGE'))); $languages = preg_split("/,/", preg_replace('/\(;q=\d+\.\d+\)/i', '', getenv('HTTP_ACCEPT_LANGUAGE')));
plugin/multilingual.1373228396.txt.gz · Last modified: 2013-07-07 22:19 by 124.110.12.173

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki