Jump to content

Wikimedia Engineering/WMF Tech Days 2012/i18n-best-practices-sept2012

From mediawiki.org

Olipa kerran pupu, se hassu pupu on.

ഒരിടത്തൊരു രസികന്‍ മുയലുണ്ടായിരുന്നു.

ஒரு முயல்குட்டி இருந்தது, அது ஒரு வேடிக்கையான முயல்குட்டி உள்ளது.

זה מצחיק אפילו בלי תרגום

Possible things to include:

[Motivation] "I18n is not an option"

  • Don't schedule for later - start immediately.
  • It doesn't just help speakers of other languages - it helps uncover bugs early.
  • Give translators time to translate and to report issues
  • Have time for fixing issues
  • Don't say "It's only for the English Wikipedia" - It happened many times that it wasn't just for the English Wikipedia.

[Practical stuff] Message writing tips

  • No lego
  • Avoid "right"/"left"
  • Avoid jargon, and if you really need it - document it.
  • Having a glossary would be awesome.
  • Good example: Wikidata (Wikibase) extensions
  • Bad example? :)
  • Avoid writing messages that assume the size of screen, button, table header. Translations can be much longer and much shorter. If you really-really need to have it, document it.

[Message documentation tips]

  • Use {{msg-mw}} when needed
  • Screenshots are supported
  • Give examples with variables replaced
  • What is it? Button text / page title / link / table header - it's important information
  • Document everything, but especially:
  • Adjectives - say what are they describing (can be masculine/feminine in other languages)
  • Messages that use other messages or are related to them, with {{msg-mw}}
  • For very short messages, say what part of speech it is - adjective, verb, noun, etc.

[Technical stuff] Tour on wfMessage (like, use numParams for numbers)

  • wfMessage or $this->msg (depending on context (pun intented!))
  • ->params ->numParams ->rawParams
  • Pick one: plain, text, parse, escapes, parseAsBlock
  • Tips on picking?..
  • Tips of reviewing?..
  • New code should accept Message objects (instead of string/array of keys/params)
  • Write the whole message name. If you have to concatenate, add a comment with the full message wherever relevant.

New logging system

  • Supports gender
  • Supports flexible word order
  • Flexible parameters
  • Many logs yet to be converted (hardest part is to understand all the legacy parameter formats)

$entry = new ManualLogEntry( 'patrol', 'patrol' ); $entry->setTarget( $rc->getTitle() ); $entry->setParameters( self::buildParams( $rc, $auto ) ); $entry->setPerformer( $user ); $logid = $entry->insert(); if ( !$auto ) {

  $entry->publish( $logid, 'udp' );

}

Particular tips on using messages in JavaScript

  • Required packages
  • Limitations
  • jQuery.i18n future

[Call for action and pointers] Call for help for fixing reported i18n issues

https://www.mediawiki.org/wiki/L10n