Opened 16 years ago

Closed 16 years ago

#1569 closed New Feature (fixed)

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 (13)

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

Download all attachments as: .zip

Change History (25)

Changed 16 years ago by B_aniaczek

Attachment: fckplugin.js added

Localized plugin body

Changed 16 years ago by B_aniaczek

Attachment: en.js added

English translation

Changed 16 years ago by B_aniaczek

Attachment: pl.js added

Polish translation

Changed 16 years ago by B_aniaczek

Attachment: image.html added

Localized dialog

Changed 16 years ago by B_aniaczek

Attachment: link.html added

Localized dialog

Changed 16 years ago by B_aniaczek

Attachment: math.html added

Localized dialog

Changed 16 years ago by B_aniaczek

Attachment: ref.html added

Localized dialog

Changed 16 years ago by B_aniaczek

Attachment: template.html added

Localized dialog

comment:1 Changed 16 years ago by Martin Kou

Keywords: localization removed

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

comment:2 Changed 16 years ago by Wojciech Olchawa

Keywords: HasPatch added

#1568 has been marked as DUP

Changed 16 years ago by Artur Formella

Attachment: 1569.patch added

comment:3 Changed 16 years ago by Artur Formella

Keywords: Review? added; HasPatch removed

comment:4 Changed 16 years ago by Wiktor Walc

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 16 years ago by Artur Formella

Attachment: 1569_2.patch added

comment:5 Changed 16 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:6 Changed 16 years ago by Wiktor Walc

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 16 years ago by Artur Formella

Attachment: 1569_3.patch added

comment:7 Changed 16 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:8 Changed 16 years ago by Wiktor Walc

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 16 years ago by Artur Formella

Attachment: 1569_4.patch added

comment:9 Changed 16 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:10 Changed 16 years ago by Wiktor Walc

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 16 years ago by Wiktor Walc

Keywords: Review+ added; Review? removed

Changed 16 years ago by Artur Formella

Attachment: en.2.js added

comment:12 Changed 16 years ago by Artur Formella

Keywords: Fixed added; Review+ removed
Resolution: fixed
Status: newclosed

Fixed with [2458]

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy