Ticket #1569 (closed New Feature: fixed)

Opened 7 years ago

Last modified 6 years ago

MediaWiki plugin localization

Reported by: B_aniaczek Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version:
Keywords: Fixed Cc:

Description

It would be great to have mediaWiki plugin localized to user language, like FCKeditor. Most things are localized, but mediaWiki specific strings are English only.

Things to do: File FCKeditor/fckeditor_config.js: Add before FCKConfig.Plugins.Add( 'mediawiki' ) ; lines:

var MediaWikiPluginAvailableLanguages = {

en : 'English', pl : 'Polish'

}; var MediaWikiPluginLanguage = 'pl';

and modify line:

FCKConfig.Plugins.Add( 'mediawiki' ) ;

to have

FCKConfig.Plugins.Add( 'mediawiki' , MediaWikiPluginLanguage ) ;

I have no idea, how to use mediaWiki settings (see ticket #1565) :(

Create directory FCKeditor/plugins/mediawiki/lang and put there en.js and pl.js (attached)

Modify files: fckplugin.js, image.html, link.html, math.html, ref.html, template.html. There is too many changes to describe them. To find differences simply look at attached my versions and look for strings: .wiki and "wiki" and search for function plural (inside image.html and link.html only).


Note about function plural( thingsToCount, found0, found1, foundSeveral, foundMore )

It returns:

found0 if there is no thingsToCount,
found1 if there is one thingsToCount,
foundSeveral if there is: 2,3,4, 22,23,24, 32,33,34, 42,43,44, ..., 102,103,104 ... and so on (but not 12,13,14,112,113,114) thingsToCount,
foundMore otherwise

It is polish specific behavior. English users (this is probably the same in many other languages) should use foundSeveral same as foundMore. In fact - plural is language specific and it should be loaded with language file, but I'm noob with javaScript to code it :( For examples look for language files in mediaWiki installation: /languages/classes/Language*.php)

Attachments

fckplugin.js (21.4 KB) - added by B_aniaczek 7 years ago.
Localized plugin body
en.js (2.9 KB) - added by B_aniaczek 7 years ago.
English translation
pl.js (3.2 KB) - added by B_aniaczek 7 years ago.
Polish translation
image.html (9.9 KB) - added by B_aniaczek 7 years ago.
Localized dialog
link.html (6.2 KB) - added by B_aniaczek 7 years ago.
Localized dialog
math.html (3.5 KB) - added by B_aniaczek 7 years ago.
Localized dialog
ref.html (3.3 KB) - added by B_aniaczek 7 years ago.
Localized dialog
template.html (3.3 KB) - added by B_aniaczek 7 years ago.
Localized dialog
1569.patch (25.3 KB) - added by arczi 6 years ago.
1569_2.patch (23.4 KB) - added by arczi 6 years ago.
1569_3.patch (26.9 KB) - added by arczi 6 years ago.
1569_4.patch (22.7 KB) - added by arczi 6 years ago.
en.2.js (3.4 KB) - added by arczi 6 years ago.

Change History

Changed 7 years ago by B_aniaczek

Localized plugin body

Changed 7 years ago by B_aniaczek

English translation

Changed 7 years ago by B_aniaczek

Polish translation

Changed 7 years ago by B_aniaczek

Localized dialog

Changed 7 years ago by B_aniaczek

Localized dialog

Changed 7 years ago by B_aniaczek

Localized dialog

Changed 7 years ago by B_aniaczek

Localized dialog

Changed 7 years ago by B_aniaczek

Localized dialog

comment:1 Changed 7 years ago by martinkou

  • Keywords localization removed

#1567 has been marked as a dup of this ticket.

comment:2 Changed 6 years ago by w.olchawa

  • Keywords HasPatch added

#1568 has been marked as DUP

Changed 6 years ago by arczi

comment:3 Changed 6 years ago by arczi

  • Keywords Review? added; HasPatch removed

comment:4 Changed 6 years ago by wwalc

  • Keywords Review- added; Review? removed

Looks promising, but a couple of things must be fixed:

  1. this patch is invalid, it is based on revisions from your local repository.
  1. all elements with fcklang attribute must have the default text value.

So instead of: <span fcklang="wikiImgFileName"></span> we need this: <span fcklang="wikiImgType">Image file name</span>

to see why it is so important, define language file with missing strings.

  1. function plural is specific, valid only for Polish language. This is much more complex thing, so let's not use it at all unless FCKeditor will support it in the core. Let's use the current way of defining strings with numbers (just "no", "one", "many").
  1. In FCKeditor.body.php AutoDetectLanguage is set to false and DefaultLanguage is set to $userLang. I suppose this may cause troubles if Mediawiki uses language that is not supported by FCKeditor. I think you could try to detect if MediaWiki language is supported by FCKeditor and only then set DefaultLanguage to $userLang (Auto detection should be enabled by default and it should be possible to disable language detection via user settings with UserToggles hook).
  1. Instead of

FCKConfig.Plugins.Add( 'mediawiki', MediaWikiPluginLanguage) ; specify all available languages at this moment FCKConfig.Plugins.Add( 'mediawiki', 'en,pl') ;

Changed 6 years ago by arczi

comment:5 Changed 6 years ago by arczi

  • Keywords Review? added; Review- removed

comment:6 Changed 6 years ago by wwalc

  • Keywords Review- added; Review? removed
  1. mediawikiPluginAvailableLangs variable can be dropped because it is used only once
  1. Some strings are not translated, for example

SetSearchMessage( 'searching...' ) in dialogs/image.html

  1. When translating message with a number, in some languages we may have to put the number at the end, or somewhere in the middle, so use wildcards in translations and then replace this wildcard with the right number.
    FCKLang.wikiLnkSearchSeveral    = 'znaleziono %s artykuły' 
    

display it later with

FCKLang.wikiLnkSearchSeveral.replace( /%1/g, foo_bar );
  1. Polish translation needs some improvements, semicolons are missing, some translations are invalid for example:

FCKLang.wikiLnkTooShort = 'za mało liter ay wyszukać';

Changed 6 years ago by arczi

comment:7 Changed 6 years ago by arczi

  • Keywords Review? added; Review- removed

comment:8 Changed 6 years ago by wwalc

  • Keywords Review- added; Review? removed

Still needs some correction.

  1. plugins/mediawiki/dialogs/image.html, link.html

In

SetSearchMessage( results.length + ' ' + (FCKLang.wikiLnkSearchSeveral || '%1 articles found').replace( /%1/g, results.length ) ) ;

this should be probably removed:

results.length + ' ' +

because %1 wildcard is replaced with results.length.

  1. plugins/mediawiki/dialogs/image.html

SetSearchMessage( 'no images found' ) ; is not translated

  1. plugins/mediawiki/lang/en.js

translations are repeated

Changed 6 years ago by arczi

comment:9 Changed 6 years ago by arczi

  • Keywords Review? added; Review- removed

comment:10 Changed 6 years ago by wwalc

Looks good, please attach en.js with full content on commit because it is empty in the latest patch. Make sure that strings in en.js are not duplicated and all ends with semicolon.

comment:11 Changed 6 years ago by wwalc

  • Keywords Review+ added; Review? removed

Changed 6 years ago by arczi

comment:12 Changed 6 years ago by arczi

  • Keywords Fixed added; Review+ removed
  • Status changed from new to closed
  • Resolution set to fixed

Fixed with [2458]

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy