r99310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99309‎ | r99310 | r99311 >
Date:13:54, 8 October 2011
Author:junaidpv
Status:reverted (Comments)
Tags:
Comment:
Narayam: Some wiki may need to load schemes for certain languages always loaded. Add a configuration item for it.
Modified paths:
  • /trunk/extensions/Narayam/Narayam.hooks.php (modified) (history)
  • /trunk/extensions/Narayam/Narayam.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/Narayam.php
@@ -41,6 +41,9 @@
4242 'key' => 'm'
4343 );
4444
 45+// Schemes for the languages specified in this arrays will be loaded always
 46+$wgNarayamAlwaysLoadForLanguages = array();
 47+
4548 // Array mapping language codes and scheme names to module names
4649 // Custom schemes can be added here
4750 $wgNarayamSchemes = array(
Index: trunk/extensions/Narayam/Narayam.hooks.php
@@ -53,10 +53,17 @@
5454
5555 /**
5656 * Get the available schemes for the user and content language
 57+ * and mandatory schemes for the languages specifed, if any.
5758 * @return array( scheme name => module name )
5859 */
5960 protected static function getSchemes() {
6061 global $wgLanguageCode, $wgLang, $wgNarayamSchemes;
 62+ global $wgNarayamAlwaysLoadForLanguages;
 63+
 64+ $mandatorySchemes = array ();
 65+ foreach ($wgNarayamAlwaysLoadForLanguages as $languageCode) {
 66+ $mandatorySchemes += $wgNarayamSchemes[$languageCode];
 67+ }
6168
6269 $userlangCode = $wgLang->getCode();
6370 $contlangSchemes = isset( $wgNarayamSchemes[$wgLanguageCode] ) ?
@@ -64,7 +71,7 @@
6572 $userlangSchemes = isset( $wgNarayamSchemes[$userlangCode] ) ?
6673 $wgNarayamSchemes[$userlangCode] : array();
6774
68 - return $userlangSchemes + $contlangSchemes;
 75+ return $mandatorySchemes + $userlangSchemes + $contlangSchemes;
6976 }
7077
7178 public static function addPreference( $user, &$preferences ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r99311Narayam: Handle unavailable languages. Fix r99310.junaidpv14:04, 8 October 2011
r99684Narayam: Revert r99310 and r99311.junaidpv14:55, 13 October 2011

Comments

#Comment by Santhosh.thottingal (talk | contribs)   16:48, 8 October 2011

Is there any bug for this feature addition? If not, can you tell any example usecase which require this feature?

#Comment by Junaidpv (talk | contribs)   17:36, 8 October 2011

Currently this not for any Wikimedia sites, but other private wikis.

Little while ago a request has been there: http://www.mediawiki.org/w/index.php?title=Extension_talk%3ANarayam&action=historysubmit&diff=430769&oldid=427314 They need Hindi typing schemes loaded regardless of language.

Similarly, people building a Tamil-Kannada dictionary has requested personally that they need Tamil and Kannada schemes loaded always.

#Comment by Santhosh.thottingal (talk | contribs)   03:06, 9 October 2011

Thanks for explanation. The configuration is at backend and can be changed only by admins, while the requirement to see additional inputmethods other than userlang or content lang seems to be an obvious one. That demands a feature in which users can select _any_ input method from UI, not limited to the ones the admin configured using wgNarayamAlwaysLoadForLanguages. This is Bug 28474 or 30132 and we are going to develop a UI for this. This UI was discussed in length during our WMF office visit and we are planning to take up in our first development sprint. So this requirement will be addressed in that, this commit will be redundant there. (we will share the plans for that feature to you)

#Comment by Junaidpv (talk | contribs)   07:40, 10 October 2011

But it is to show mandatory schemes for the wiki. As I have pointed out one example, for a dictionary wiki project that require both Kannada and Tamil, all users must be presented with Kannada and Tamil tools, rather than forcing all users to select them from their preferences.

#Comment by Junaidpv (talk | contribs)   14:58, 13 October 2011

Okay, I have reverted this: r99684.

Status & tagging log