Revision: 2307
http://mrbs.svn.sourceforge.net/mrbs/?rev=2307&view=rev
Author: cimorrison
Date: 2012-06-29 15:24:17 +0000 (Fri, 29 Jun 2012)
Log Message:
-----------
Added an array of substitute languages, for example to substitute 'no' for
'nb-NO'. This can be useful when a translation for the default
accept-language sent by a browser does not exist, but an adequate substitute
does. For example, IE9 in a default Norwegian Windows installation sends
'nb-NO'.
Modified Paths:
--------------
mrbs/trunk/web/language.inc
Modified: mrbs/trunk/web/language.inc
===================================================================
--- mrbs/trunk/web/language.inc 2012-06-29 14:02:27 UTC (rev 2306)
+++ mrbs/trunk/web/language.inc 2012-06-29 15:24:17 UTC (rev 2307)
@@ -4,6 +4,17 @@
require_once "functions.inc";
+// An array of substitute languages.
+// This can be useful when a translation for the default accept-language sent
by
+// a browser does not exist, but an adequate substitute does. For example,
IE9 in
+// a default Norwegian Windows installation sends 'nb-NO'.
+$lang_subs = array
+(
+ 'nb-NO' => 'no',
+ 'nn-NO' => 'no'
+);
+
+
// A map is needed to convert from the HTTP language specifier to a
// locale specifier for Windows
//
@@ -694,11 +705,18 @@
// Set $vocab. Returns TRUE if a lang file is found, otherwise FALSE
function set_vocab($lang)
{
- global $vocab_override, $cli_mode;
+ global $vocab_override, $cli_mode, $lang_subs;
global $PHP_SELF;
global $vocab, $mrbs_admin, $mrbs_company; // Used in lang files
+ // Use a substitute language if there is one
+ if (isset($lang_subs[$lang]))
+ {
+ $lang = $lang_subs[$lang];
+ }
+
$lang = strtolower($lang);
+
$lang_file = "lang/lang.$lang";
// When in CLI mode, we need to add the full path name as
// file_exists() ignores the include path
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits