[pLog-svn] r1790 - plog/branches/plog-1.0.1/class/locale
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri Apr 8 20:07:53 GMT 2005
Author: oscar
Date: 2005-04-08 20:07:52 +0000 (Fri, 08 Apr 2005)
New Revision: 1790
Modified:
plog/branches/plog-1.0.1/class/locale/locales.class.php
Log:
hopefully this solves issue 415 (http://bugs.plogworld.net/view.php?id=415), since I thought that this was working since 1.0 but in fact it wasn't :( If there is a plugin that does not include the locale being currently used in the blog, then we should use en_UK so that at least we display something!
Modified: plog/branches/plog-1.0.1/class/locale/locales.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/locale/locales.class.php 2005-04-08 19:49:14 UTC (rev 1789)
+++ plog/branches/plog-1.0.1/class/locale/locales.class.php 2005-04-08 20:07:52 UTC (rev 1790)
@@ -64,23 +64,28 @@
if( isset($loadedLocales[$localeCode] )) {
$locale = $loadedLocales[$localeCode];
}
- else {
+ else {
$locale = new Locale( $localeCode );
- // check if we have any plugin locales loaded for this language
- global $_plugins_loadedLocales;
- if( is_array( $_plugins_loadedLocales["$localeCode"] )) {
- foreach( $_plugins_loadedLocales["$localeCode"] as $pluginLocale ) {
- $locale->mergeLocale( $pluginLocale );
- }
- }
- elseif( is_array( $_plugins_loadedLocales["en_UK"] )) {
- // if not, we can always use english as the default... hoping that the plugin will
- // provide a translation!
- foreach( $_plugins_loadedLocales["en_UK"] as $pluginLocale ) {
- $locale->mergeLocale( $pluginLocale );
- }
- }
+ // check if we have any plugin locales loaded for this language
+ global $_plugins_loadedLocales;
+
+ // loop through all the plugins, and check which ones of them provide the current locale and
+ // which ones doesn't. If the blog uses a locale that the plugin does not provide, then we'll
+ // use en_UK as the default, or else we'll load the correct one.
+ foreach( $_plugins_loadedLocales as $pluginId => $pluginLocales ) {
+ if( is_array( $pluginLocales )) {
+ // let's check if the plugin has the locale that we need
+ if( isset( $pluginLocales["$localeCode"] )) {
+ $locale->mergeLocale( $pluginLocales["$localeCode"] );
+ }
+ else {
+ if( isset( $pluginLocales["en_UK"] )) {
+ $locale->mergeLocale( $pluginLocales["en_UK"] );
+ }
+ }
+ }
+ }
$loadedLocales[$localeCode] = $locale;
}
@@ -98,6 +103,8 @@
function getPluginLocale( $pluginId, $localeCode = null )
{
global $_plugins_loadedLocales;
+
+ print("here? - pluginId = $pluginId -- locale code = $localeCode<br/>");
if( $localeCode == null ) {
$config =& Config::getConfig();
@@ -109,12 +116,12 @@
// check if we have already loaded that locale or else, load it from
// disk and keep it for later, just in case anybody asks again
- if( isset($_plugins_loadedLocales[$localeCode][$pluginLocaleKey] )) {
- $locale = $_plugins_loadedLocales[$localeCode][$pluginLocaleKey];
+ if( isset($_plugins_loadedLocales[$pluginLocaleKey][$localeCode] )) {
+ $locale = $_plugins_loadedLocales[$pluginLocaleKey][$localeCode];
}
else {
$locale = new PluginLocale( $pluginId, $localeCode );
- $_plugins_loadedLocales[$localeCode][$pluginLocaleKey] = $locale;
+ $_plugins_loadedLocales[$pluginLocaleKey][$localeCode] = $locale;
}
return $locale;
More information about the pLog-svn
mailing list