Backstage with Drupal localization

  Gábor Hojtsy & Jose Reyero
                               26. aug 14:45
            ...
TRANSLATING
THE BUILT-IN
 INTERFACE
TEXT COMES FROM
  SOURCE CODE
D!"#$% 6 Ch!$for new versions at hojtsy.hu – Freely redistri
                                                             ...
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
             ...
Running
 source code
                      Found text
                     stored in DB


Text replaced on    User interfa...
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)...
Static
         source code
              Automation


              Gettext
              Database
             .pot (CVS...
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
Backstage with Drupal localization - Part 1
Upcoming SlideShare
Loading in...5
×

Backstage with Drupal localization - Part 1

1,543

Published on

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.

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • 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
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total Views
1,543
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Backstage with Drupal localization - Part 1

  1. 1. Backstage with Drupal localization Gábor Hojtsy & Jose Reyero 26. aug 14:45 VPS.NET 18
  2. 2. TRANSLATING THE BUILT-IN INTERFACE
  3. 3. TEXT COMES FROM SOURCE CODE
  4. 4. 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
  5. 5. TEXT IS FOUND AND REPLACED RUNTIME, WHEN USED
  6. 6. TRANSLATIONS ARE STORED IN THE DATABASE
  7. 7. Running source code
  8. 8. Running source code Found text stored in DB
  9. 9. Running source code Found text stored in DB User interface to translate text, stored in DB
  10. 10. Running source code Found text stored in DB Text replaced on User interface output to translate text, stored in DB
  11. 11. Static source code
  12. 12. Static source code Gettext .pot (CVS)
  13. 13. Static source code Gettext .pot (CVS)
  14. 14. Static source code Gettext .pot (CVS) Translated .po (CVS)
  15. 15. Static source code Gettext .pot (CVS) Translated .po (CVS)
  16. 16. Static source code Gettext .pot (CVS) Translated .po (CVS)
  17. 17. Static source code Gettext Database .pot (CVS) Translated .po (CVS)
  18. 18. Static source code Automation Gettext Database .pot (CVS) Translated .po (CVS)
  19. 19. Static source code Automation Gettext Database .pot (CVS) Web UI Translated .po (CVS)
  20. 20. Static source code Automation Gettext Database .pot (CVS) Web UI Translated .po (CVS) (FTP)
  21. 21. Static source code Automation Gettext Database .pot (CVS) Web UI Automation Translated .po (CVS) (FTP)
  22. 22. Static source code Automation Gettext Database .pot (CVS) Web UI Contribute Automation Translated .po (CVS) (FTP)
  23. 23. Static source code Automation Gettext Database .pot (CVS) Web UI Contribute Automation Translated Pull .po (CVS) (FTP)
  24. 24. over almost 6700 14000 projects known releases parsed
  25. 25. over 219000 strings to translate
  26. 26. 219000 LIKE TRANSLATING DRUPAL 34 TIMES
  27. 27. 71 TRANSLATION TEAMS
  28. 28. OVER 1700 CONTRIBUTORS
  29. 29. http://cph2010.drupal.org/node/8808
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×