[geeklog-hg] geeklog: Moved and reworded some Language Configuration Options ...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jul 14 09:22:43 EDT 2013
changeset 9194:ec93e765084c
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ec93e765084c
user: Tom <websitemaster at cogeco.net>
date: Sun Jul 14 09:18:50 2013 -0400
description:
Moved and reworded some Language Configuration Options (and docs) to make it easier to understand how to setup multi-language content sites. For multi-language sites user language selection is now restricted to what has been mapped (feature request #0001620)
diffstat:
language/english.php | 3 +-
language/english_utf-8.php | 3 +-
public_html/admin/configuration_validation.php | 2 +-
public_html/admin/install/config-install.php | 8 ++++--
public_html/docs/english/config.html | 29 +++++++++++++++++--------
public_html/usersettings.php | 9 ++++++-
sql/updates/mssql_2.0.0_to_2.0.1.php | 9 ++++++++
sql/updates/mysql_2.0.0_to_2.0.1.php | 9 ++++++++
sql/updates/pgsql_2.0.0_to_2.0.1.php | 9 ++++++++
system/lib-mbyte.php | 11 ++++++++-
10 files changed, 72 insertions(+), 20 deletions(-)
diffs (243 lines):
diff -r 4522161bf952 -r ec93e765084c language/english.php
--- a/language/english.php Sat Jul 13 14:23:26 2013 -0400
+++ b/language/english.php Sun Jul 14 09:18:50 2013 -0400
@@ -1937,7 +1937,7 @@
'twitter_consumer_secret' => "Twitter OAuth Consumer Secret",
'spamx' => "Spam-X Actions",
'sort_admin' => "Sort Links",
- 'language' => "Language",
+ 'language' => "Default Language",
'locale' => "Locale",
'date' => "Date Format",
'daytime' => "Daytime Format",
@@ -2167,6 +2167,7 @@
'fs_admin_block' => 'Admin Block',
'fs_locale' => 'Locale',
'fs_language' => 'Language',
+ 'fs_multilanguage' => 'Multi-Language Content',
'fs_debug' => 'Debug',
'fs_cookies' => 'Cookies',
'fs_login' => 'Login Settings',
diff -r 4522161bf952 -r ec93e765084c language/english_utf-8.php
--- a/language/english_utf-8.php Sat Jul 13 14:23:26 2013 -0400
+++ b/language/english_utf-8.php Sun Jul 14 09:18:50 2013 -0400
@@ -1937,7 +1937,7 @@
'twitter_consumer_secret' => "Twitter OAuth Consumer Secret",
'spamx' => "Spam-X Actions",
'sort_admin' => "Sort Links",
- 'language' => "Language",
+ 'language' => "Default Language",
'locale' => "Locale",
'date' => "Date Format",
'daytime' => "Daytime Format",
@@ -2167,6 +2167,7 @@
'fs_admin_block' => 'Admin Block',
'fs_locale' => 'Locale',
'fs_language' => 'Language',
+ 'fs_multilanguage' => 'Multi-Language Content',
'fs_debug' => 'Debug',
'fs_cookies' => 'Cookies',
'fs_login' => 'Login Settings',
diff -r 4522161bf952 -r ec93e765084c public_html/admin/configuration_validation.php
--- a/public_html/admin/configuration_validation.php Sat Jul 13 14:23:26 2013 -0400
+++ b/public_html/admin/configuration_validation.php Sun Jul 14 09:18:50 2013 -0400
@@ -283,7 +283,6 @@
/* Subgroup Users and Submissions, Tab Users */
$_CONF_VALIDATE['Core']['disable_new_user_registration'] = array('rule' => 'boolean');
$_CONF_VALIDATE['Core']['allow_user_themes'] = array('rule' => 'boolean');
-$_CONF_VALIDATE['Core']['allow_user_language'] = array('rule' => 'boolean');
$_CONF_VALIDATE['Core']['allow_user_photo'] = array('rule' => 'boolean');
$_CONF_VALIDATE['Core']['allow_username_change'] = array('rule' => 'boolean');
$_CONF_VALIDATE['Core']['allow_account_delete'] = array('rule' => 'boolean');
@@ -423,6 +422,7 @@
'message' => isset($LANG_VALIDATION['language']) ?
$LANG_VALIDATION['language'] : $LANG_VALIDATION['default']
);
+$_CONF_VALIDATE['Core']['allow_user_language'] = array('rule' => 'boolean');
/* Subgroup Language, Tab Locale */
$_CONF_VALIDATE['Core']['locale'] = array('rule' => 'stringOrEmpty');
diff -r 4522161bf952 -r ec93e765084c public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php Sat Jul 13 14:23:26 2013 -0400
+++ b/public_html/admin/install/config-install.php Sun Jul 14 09:18:50 2013 -0400
@@ -222,7 +222,7 @@
$c->add('fs_users', NULL, 'fieldset', 4, 16, NULL, 0, TRUE, $me, 16);
$c->add('disable_new_user_registration',FALSE,'select',4,16,0,220,TRUE, $me, 16);
$c->add('allow_user_themes',1,'select',4,16,0,230,TRUE, $me, 16);
- $c->add('allow_user_language',1,'select',4,16,0,240,TRUE, $me, 16);
+ // $c->add('allow_user_language',1,'select',4,16,0,240,TRUE, $me, 16); Moved to Language Tab
$c->add('allow_user_photo',1,'select',4,16,0,250,TRUE, $me, 16);
$c->add('allow_username_change',0,'select',4,16,0,260,TRUE, $me, 16);
$c->add('allow_account_delete',0,'select',4,16,0,270,TRUE, $me, 16);
@@ -347,8 +347,10 @@
$c->add('tab_language', NULL, 'tab', 6, 28, NULL, 0, TRUE, $me, 28);
$c->add('fs_language', NULL, 'fieldset', 6, 28, NULL, 0, TRUE, $me, 28);
$c->add('language','english','select',6,28,NULL,350,TRUE, $me, 28);
- $c->add('language_files',array('en'=>'english_utf-8', 'de'=>'german_formal_utf-8'),'*text',6,28,NULL,470,FALSE, $me, 28);
- $c->add('languages',array('en'=>'English', 'de'=>'Deutsch'),'*text',6,28,NULL,480,FALSE, $me, 28);
+ $c->add('allow_user_language',1,'select',6,28,0,360,TRUE, $me, 28);
+ $c->add('fs_multilanguage', NULL, 'fieldset', 6, 29, NULL, 0, TRUE, $me, 28);
+ $c->add('language_files',array('en'=>'english_utf-8', 'de'=>'german_formal_utf-8'),'*text',6,29,NULL,470,FALSE, $me, 28);
+ $c->add('languages',array('en'=>'English', 'de'=>'Deutsch'),'*text',6,28,NULL,480,FALSE, $me, 29);
$c->add('tab_locale', NULL, 'tab', 6, 29, NULL, 0, TRUE, $me, 29);
$c->add('fs_locale', NULL, 'fieldset', 6, 29, NULL, 0, TRUE, $me, 29);
diff -r 4522161bf952 -r ec93e765084c public_html/docs/english/config.html
--- a/public_html/docs/english/config.html Sat Jul 13 14:23:26 2013 -0400
+++ b/public_html/docs/english/config.html Sun Jul 14 09:18:50 2013 -0400
@@ -772,10 +772,6 @@
<td valign="top">Can be 1 or 0</td>
<td valign="top">If set to 1, users can set their own theme that the site uses</td></tr>
<tr>
- <td valign="top"><a name="desc_allow_user_language">allow_user_language</a></td>
- <td valign="top">Can be 1 or 0</td>
- <td valign="top">If set to 1, users can select the language for the site navigation</td></tr>
-<tr>
<td valign="top"><a name="desc_allow_user_photo">allow_user_photo</a></td>
<td valign="top">Can be 1 or 0</td>
<td valign="top">If set to 1, users can upload a photo to their profile</td></tr>
@@ -1356,21 +1352,34 @@
<tr>
<td valign="top"><a name="desc_language">language</a></td>
<td valign="top">english</td>
- <td valign="top">Name of your language file. Additional language files may be
+ <td valign="top">The default language of the Geeklog site. Additional language files may be
available for download at <a href="http://www.geeklog.net/">http://www.geeklog.net</a>.
If you translate a language file, please send it to us. Also see <a
- href="#Localization">Localization</a> below.</td></tr>
+ href="#Localization">Localization</a> below. If you wish to remove languages from this list and what the user can pick from,
+ just delete the corresponding language file(s) from the Geeklog language directory.</td></tr>
+<tr>
+ <td valign="top"><a name="desc_allow_user_language">allow_user_language</a></td>
+ <td valign="top">Can be 1 or 0</td>
+ <td valign="top">If set to 1, users can select the language for the site labels from My Account.</td></tr>
<tr>
<td valign="top"><a name="desc_language_files">language_files</a></td>
<td valign="top"><i>(disabled)</i></td>
- <td valign="top">For multi-lingual setups only: A list mapping language
- shortcuts ('en', 'de', etc.) to the Geeklog language files to use.</td></tr>
+ <td valign="top">For multi-lingual content setups only: A list mapping language
+ shortcuts ('en', 'de', etc.) to the Geeklog language files to use. These shortcuts must each contain the same number of characters and
+ the language file must exist in the Geeklog languages directory.<br>
+ When creating content that supports multiple langagues (topics, articles, blocks, staticpages, etc.)
+ you would end the id of the content with one of these shortcuts ('storyid_en' or 'storyid2_de'). This would then map this content to the specific language.
+ For more information on how multi-language content works with Geeklog please visit our <a href="http://wiki.geeklog.net/index.php/Multi-Language_Support">Wiki</a>.<br>
+ For multi-language content sites Admins must setup both language_files and languages configuration options for the same languages.
+ Both must either be enabled (for multi-language content) or disabled (for content of only one language).</td></tr>
<tr>
<td valign="top"><a name="desc_languages">languages</a></td>
<td valign="top"><i>(disabled)</i></td>
- <td valign="top">For multi-lingual setups only: A list mapping language
+ <td valign="top">For multi-lingual content setups only: A list mapping language
shortcuts ('en', 'de', etc.) to the language's native name ("English",
- "Deutsch", etc.).</td></tr>
+ "Deutsch", etc.). These shortcuts must match the shortcuts set in the "Language Files" configuration option.<br>
+ For multi-language content sites Admins must setup both language_files and languages configuration options for the same languages.
+ Both must either be enabled (for multi-language content) or disabled (for content of only one language).</td></tr>
</table>
<p>Also see <a href="http://wiki.geeklog.net/wiki/index.php/Multi-Language_Support">Multi-Language Support</a> in the Geeklog Wiki.</p>
diff -r 4522161bf952 -r ec93e765084c public_html/usersettings.php
--- a/public_html/usersettings.php Sat Jul 13 14:23:26 2013 -0400
+++ b/public_html/usersettings.php Sun Jul 14 09:18:50 2013 -0400
@@ -483,8 +483,13 @@
$userlang = $_USER['language'];
}
- // Get available languages
- $language = MBYTE_languageList ($_CONF['default_charset']);
+ // if multi-language content return just languages supported (assume config options are setup correctly and both contain the same language mappings)
+ if (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) {
+ $language = MBYTE_languageList ($_CONF['default_charset'], true);
+ } else {
+ // Get available languages
+ $language = MBYTE_languageList ($_CONF['default_charset']);
+ }
$has_valid_language = count (array_keys ($language, $userlang));
if ($has_valid_language == 0) {
diff -r 4522161bf952 -r ec93e765084c sql/updates/mssql_2.0.0_to_2.0.1.php
--- a/sql/updates/mssql_2.0.0_to_2.0.1.php Sat Jul 13 14:23:26 2013 -0400
+++ b/sql/updates/mssql_2.0.0_to_2.0.1.php Sun Jul 14 09:18:50 2013 -0400
@@ -46,6 +46,15 @@
$c->add('autotag_permissions_topic', array(2, 2, 2, 2), '@select', 7, 41, 28, 1890, TRUE, $me, 37);
$c->add('autotag_permissions_related_topics', array(2, 2, 0, 0), '@select', 7, 41, 28, 1900, TRUE, $me, 37);
$c->add('autotag_permissions_related_items', array(2, 2, 0, 0), '@select', 7, 41, 28, 1910, TRUE, $me, 37);
+
+ // Update Language Configuration
+ $c->del('allow_user_language', 'Core');
+ $c->add('allow_user_language', 1,'select',6,28,0,360,TRUE, $me, 28); // Move from Users and Submissions to Language
+ $c->add('fs_multilanguage', NULL, 'fieldset', 6, 29, NULL, 0, TRUE, $me, 28);
+ $c->del('language_files', 'Core');
+ $c->add('language_files',array('en'=>'english_utf-8', 'de'=>'german_formal_utf-8'),'*text',6,29,NULL,470,FALSE, $me, 28);
+ $c->del('languages', 'Core');
+ $c->add('languages',array('en'=>'English', 'de'=>'Deutsch'),'*text',6,29,NULL,480,FALSE, $me, 28);
return true;
}
diff -r 4522161bf952 -r ec93e765084c sql/updates/mysql_2.0.0_to_2.0.1.php
--- a/sql/updates/mysql_2.0.0_to_2.0.1.php Sat Jul 13 14:23:26 2013 -0400
+++ b/sql/updates/mysql_2.0.0_to_2.0.1.php Sun Jul 14 09:18:50 2013 -0400
@@ -46,6 +46,15 @@
$c->add('autotag_permissions_topic', array(2, 2, 2, 2), '@select', 7, 41, 28, 1890, TRUE, $me, 37);
$c->add('autotag_permissions_related_topics', array(2, 2, 0, 0), '@select', 7, 41, 28, 1900, TRUE, $me, 37);
$c->add('autotag_permissions_related_items', array(2, 2, 0, 0), '@select', 7, 41, 28, 1910, TRUE, $me, 37);
+
+ // Update Language Configuration
+ $c->del('allow_user_language', 'Core');
+ $c->add('allow_user_language', 1,'select',6,28,0,360,TRUE, $me, 28); // Move from Users and Submissions to Language
+ $c->add('fs_multilanguage', NULL, 'fieldset', 6, 29, NULL, 0, TRUE, $me, 28);
+ $c->del('language_files', 'Core');
+ $c->add('language_files',array('en'=>'english_utf-8', 'de'=>'german_formal_utf-8'),'*text',6,29,NULL,470,FALSE, $me, 28);
+ $c->del('languages', 'Core');
+ $c->add('languages',array('en'=>'English', 'de'=>'Deutsch'),'*text',6,29,NULL,480,FALSE, $me, 28);
return true;
}
diff -r 4522161bf952 -r ec93e765084c sql/updates/pgsql_2.0.0_to_2.0.1.php
--- a/sql/updates/pgsql_2.0.0_to_2.0.1.php Sat Jul 13 14:23:26 2013 -0400
+++ b/sql/updates/pgsql_2.0.0_to_2.0.1.php Sun Jul 14 09:18:50 2013 -0400
@@ -46,6 +46,15 @@
$c->add('autotag_permissions_topic', array(2, 2, 2, 2), '@select', 7, 41, 28, 1890, TRUE, $me, 37);
$c->add('autotag_permissions_related_topics', array(2, 2, 0, 0), '@select', 7, 41, 28, 1900, TRUE, $me, 37);
$c->add('autotag_permissions_related_items', array(2, 2, 0, 0), '@select', 7, 41, 28, 1910, TRUE, $me, 37);
+
+ // Update Language Configuration
+ $c->del('allow_user_language', 'Core');
+ $c->add('allow_user_language', 1,'select',6,28,0,360,TRUE, $me, 28); // Move from Users and Submissions to Language
+ $c->add('fs_multilanguage', NULL, 'fieldset', 6, 29, NULL, 0, TRUE, $me, 28);
+ $c->del('language_files', 'Core');
+ $c->add('language_files',array('en'=>'english_utf-8', 'de'=>'german_formal_utf-8'),'*text',6,29,NULL,470,FALSE, $me, 28);
+ $c->del('languages', 'Core');
+ $c->add('languages',array('en'=>'English', 'de'=>'Deutsch'),'*text',6,29,NULL,480,FALSE, $me, 28);
return true;
}
diff -r 4522161bf952 -r ec93e765084c system/lib-mbyte.php
--- a/system/lib-mbyte.php Sat Jul 13 14:23:26 2013 -0400
+++ b/system/lib-mbyte.php Sun Jul 14 09:18:50 2013 -0400
@@ -35,7 +35,7 @@
// This function is supposed to display only language files in selection drop-
// downs that are utf-8
-function MBYTE_languageList ($charset = 'utf-8')
+function MBYTE_languageList ($charset = 'utf-8', $multilanguage = false)
{
global $_CONF;
@@ -73,7 +73,14 @@
}
$lngname .= ' (' . trim ($lngadd) . ')';
}
- $language[$file] = $lngname;
+ // Multi language content
+ if ($multilanguage) {
+ if (in_array($file,$_CONF['language_files'])) {
+ $language[$file] = $lngname;
+ }
+ } else {
+ $language[$file] = $lngname;
+ }
}
}
asort ($language);
More information about the geeklog-cvs
mailing list