Backstage with Drupal localization - Part 1
Upcoming SlideShare
Loading in...5
×
 

Backstage with Drupal localization - Part 1

on

  • 1,411 views

Backstage with Drupal localization session slides part 1 from Drupalcon Copenhagen. See part 2 at http://www.slideshare.net/devseed/backstage-with-drupal-localization-part-2.

Backstage with Drupal localization session slides part 1 from Drupalcon Copenhagen. See part 2 at http://www.slideshare.net/devseed/backstage-with-drupal-localization-part-2.

Statistics

Views

Total Views
1,411
Views on SlideShare
1,411
Embed Views
0

Actions

Likes
0
Downloads
11
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Would you have any notes or scripts of your session?
    I’m gathering the information to update manual and futur plan for the French Community.

    I couldn’t find any recording of your joint session with Jose on drupalcon website or archive.org Just de slides but it’s far too litle informations
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Backstage with Drupal localization - Part 1 Backstage with Drupal localization - Part 1 Presentation Transcript

  • Backstage with Drupal localization Gábor Hojtsy & Jose Reyero 26. aug 14:45 VPS.NET 18
  • TRANSLATING THE BUILT-IN INTERFACE
  • TEXT COMES FROM SOURCE CODE
  • D!"#$% 6 Ch!$for new versions at hojtsy.hu – Freely redistri y Gábor Hojtsy – ion API JavaScript translat to the Translates ‘Home’ ge display. ion API e’) language used fo r pa Core PHP translat to the Drupal.t(‘Hom Translates ‘Home’ t(‘Home’) requested language. lation for Plural Returns the proper trans Drupal.format ral rules in Returns the proper (count, the text based on plu format_plural & '(%$&)*' sed age. lation for the text ba ‘1 comment’, the page’s langu eck ($count, trans les in the ents’) ‘1 comment’, on plural ru ‘@count comm ts’) requested language. can be provided, ‘@count comm en placements array Optional variable realways the page language! and language is GET THE placements array Optional variable re provided in this order. acters) language code ca n be ased on prefix char Repla cement formats (b value escaped with ns using translation features Replaced with the ut. Other PHP functio @count check_plain() for outp format_date Translates parts of the +,-$& (,--&bu. ble as long as credit is kept. d value escaped an ($tim estamp, date/time formatting. Replaced with the r (theme 'medium', ...) ted as a placeholde %size format interval in eholder’)). CHEAT SHEET Displays the time (‘plac anslates t l format_interva human terms. Tr value as is, withou ) gments. Replaced with the ting. Insecure! Only ($ timestamp, ... names of the se ional format !html any additu already sanitized your text. provided use if yo Formats a file size e MB, y( tes. Translates th irectory’, arra ize, ...) in by me moved to @d format_size($s Example: t(‘%na y’ => $dirnam e); ta . KB and byte labels me, ‘@director 1.1 - '*.-/0 ‘%na me’ => $filena e code at the end. FROM an optional languag All functions accept the installer Translating text in ed later y as t(), but translation and us Works the same wa ckend. Use Text extracted for ory ba e; Module/theme nam name. uses a file+mem and in install .info files description; package st(‘Home’) only in the installer support. profiles. No plural names, Literal permission ard hook_p erm() when provided with stand ll files and any -! 15. 2007. HOJTSY.HU ns array syntax. Use get_t() in .insta implementatio could run in the other code which s ‘t’ or ‘st’ $t = get_t(); installer too. It retu nction to be d rn Menu item ‘title’ an en fu hook_menu() ‘description’ keys , wh $t (‘Home’); depending on the l strings. t. impl ementations provided as litera used at the momen sage, Log type and mes ral ur use translation, yo le provided as lite ll file and need to when Remember: if you have an .insta running in the installer if your modu u’, strings. Third parameter easily end up e get_t()! watchdog(‘men function calls could core module in an install profile. Us calls specifies the replacements become sa ‘Items saved’) pport. array. No plural su bal context, mistakes Usage of t() in a glo ST’, t(‘...’)). The The most common e message eg. for such as define( ‘CON type). Reuse of the sam t yet initialized at lues, such as t($ t_message() locale system is no e is incorrect Using dynamic va g() and drupal_se strings to call watchdo allows t(), the later ag dynamic Whenever you use make sure that all that time, so this us ALSO SEE , calls. The former dis t possible. ds to nasty perform ance the above functions eady in the code is no requires t(), so this e API functions and also lea it. po ssible values are alr using the API. Always call the abov problems. Never do l form indirection. elsewhere in litera ovided content. directly, without user pr Do not translate pport, so e API properly r module plugin su Tools to verify you are using th er versions have code ws. Also feel free to export a Drupal 6.x-2 or lat revie e API is reported in ings appear. improper use of th ule/theme and check whether all str D.O/NODE/322729 rg/proje ct/potx od http://drupal.o template for your m use t() or some when you forgot to nnot find mistakes e localization client has a The potx module ca late your output. Th ns ge. If certain other function to tra to translate text displayed on the pa the API. rg/project/l10n _client convenient interface , you forgot to use http://drupal.o ing up for translation str ings are not show
  • TEXT IS FOUND AND REPLACED RUNTIME, WHEN USED
  • TRANSLATIONS ARE STORED IN THE DATABASE
  • Running source code
  • Running source code Found text stored in DB
  • Running source code Found text stored in DB User interface to translate text, stored in DB
  • Running source code Found text stored in DB Text replaced on User interface output to translate text, stored in DB
  • Static source code
  • Static source code Gettext .pot (CVS)
  • Static source code Gettext .pot (CVS)
  • Static source code Gettext .pot (CVS) Translated .po (CVS)
  • Static source code Gettext .pot (CVS) Translated .po (CVS)
  • Static source code Gettext .pot (CVS) Translated .po (CVS)
  • Static source code Gettext Database .pot (CVS) Translated .po (CVS)
  • Static source code Automation Gettext Database .pot (CVS) Translated .po (CVS)
  • Static source code Automation Gettext Database .pot (CVS) Web UI Translated .po (CVS)
  • Static source code Automation Gettext Database .pot (CVS) Web UI Translated .po (CVS) (FTP)
  • Static source code Automation Gettext Database .pot (CVS) Web UI Automation Translated .po (CVS) (FTP)
  • Static source code Automation Gettext Database .pot (CVS) Web UI Contribute Automation Translated .po (CVS) (FTP)
  • Static source code Automation Gettext Database .pot (CVS) Web UI Contribute Automation Translated Pull .po (CVS) (FTP)
  • over almost 6700 14000 projects known releases parsed
  • over 219000 strings to translate
  • 219000 LIKE TRANSLATING DRUPAL 34 TIMES
  • 71 TRANSLATION TEAMS
  • OVER 1700 CONTRIBUTORS
  • http://cph2010.drupal.org/node/8808