0
Translate Drupal!
Gábor Hojtsy, Acquia, DrupalCamp Prague 2009
ME

• Needed   a translated Drupal in 2003

• Became locale.module maintainer,
 Drupal 6 core committer
• Developed   all ...
YOU

• Running   translated Drupal sites?

• Translating   modules for “self”?

• Contributing   to drupal.org translation...
TRANSLATING
THE BUILT-IN
 INTERFACE
TEXT COMES
    FROM
SOURCE CODE
t(‘Go to %page’,
array(‘%page’ => $p));


Drupal.t(‘Go to %page’,
       {‘%page’: num});
format_plural(
   $count,
   ‘1 year’, ‘@count years’
);

Drupal.formatPlural(
   count,
   ‘1 year’, ‘@count years’
);
D!"#$% 6 Ch!$for new versions at hojtsy.hu – Freely redistri
                                                             ...
TEXT IS FOUND
 AND REPLACED
RUNTIME, WHEN
     USED
Hungarian           Croatian


Go to %page    %page. oldalra ugrás       ...


   1 year             1 év
                ...
TRANSLATIONS
   ARE STORED
IN THE DATABASE
DRUPAL PROCESS
  Running
source code
DRUPAL PROCESS
  Running
source code
                   Found text
                  stored in DB
DRUPAL PROCESS
  Running
source code
                   Found text
                  stored in DB


                 User ...
DRUPAL PROCESS
   Running
 source code
                      Found text
                     stored in DB


Text replaced ...
Where’s the happy family?
TRANSLATIONS
  ARE SHARED
IN GETTEXT .PO
SHARING PROCESS
SHARING PROCESS
SHARING PROCESS
                     Static
                  source code
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
•Translation template       Static
 extractor               source code
•http://drupal.org/
 project/potx
•Web interface i...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
Desktop tools like
PoEdit or just Notepad



                          Gettext
                           .pot


         ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
•Translation teams commit .po files to CVS
•http://drupal.org/project/Translations
 and under contributed projects
•Release...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
•Built-in translation interface
•http://drupal.org/project/l10n_client
•Import and export .po(t) files manually
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
SHARING PROCESS
                     Static
                  source code


                   Gettext
                   ...
All come together
GIVING AWAY
 (THIS WAY)
   IS HARD
POTX
.PO

POTX
.PO
CVS
 POTX
.PO
CVS
  POTX


RELEASES
.PO
CVS
  POTX


RELEASES
           BRANCHES
.PO
CVS        PLURAL FORMS
  POTX


RELEASES
           BRANCHES
.PO
CVS        PLURAL FORMS
  POTX

           SCHEDULING
RELEASES
           BRANCHES
.PO
CVS        PLURAL FORMS
    POTX

               SCHEDULING
RELEASES
               BRANCHES
ISSUE QUEUES
ENOUGH!
LOCALIZE.DRUPAL.ORG


Web UI for Drupal.org
 project translations
LOCALIZE.DRUPAL.ORG


Automated parsing of
Drupal.org releases on
    publication
LOCALIZE.DRUPAL.ORG


  Skips CVS, branching,
templates, hides potx and
  plural forms, does not
  require desktop tools
LOCALIZE.DRUPAL.ORG



 Single-sign-on with
     Drupal.org
LOCALIZE.DRUPAL.ORG



 Organic groups based
     translations
LOCALIZE.DRUPAL.ORG



Different permission levels
     (open/controlled)
LOCALIZE.DRUPAL.ORG


 Keeps import/export
 support with Gettext
       formats
LOCALIZE.DRUPAL.ORG


   Provides a remote
submission web service for
   Localization client
Oh, those stats!
almost                               over


5250                               6900
projects known                      re...
159000
  IT IS LIKE
TRANSLATING
   DRUPAL
  45 TIMES
38
  TRANSLATION
TEAMS LAUNCHED
ALREADY IN BETA
(MORE IN QUEUE)
Take a ride!
Envious?
SOFTWARE ON L.D.O

• Translation
            template extractor
 http://drupal.org/project/potx

• Localization
          ...
TRANSLATE YOUR CODE

• Open Atrium and Gallery 2 uses
 Localization server to translate their
 code

• Youcan set up l10n_...
Long way to go
Color the future!
THESE SLIDES ARE (CC)
                                          Photo credits:
                                 http://www...
THANK YOU!
 Gábor Hojtsy, Acquia
  gabor@hojtsy.hu
   http://hojtsy.hu/
Translate Drupal from Drupalcamp Prague
Upcoming SlideShare
Loading in...5
×

Translate Drupal from Drupalcamp Prague

1,106

Published on

Translate Drupal! slides from Drupalcamp Prague, November 1st, 2009.

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • LA PERSONA QUE ME LO ENVIO ESTA TODAVIA ASOMBRADA DE LO OCURRIDO, YA QUE ELLA DICE QUE LO HIZO POR HACERLO Y QUE PIDIO ALGO QUE CREIA CASI IMPOSIBLE DE LOGRAR PROBEMOS. * Para ti mismo di el nombre de la unica persona del sexo opuesto con quien quieras estar (tres veces...)... * Piensa en algo que quieras lograr dentro de la proxima semana y repitelo para ti mismo(a) (seis veces)... * Piensa en algo que quieras que pase entre tu y la persona especial (que dijiste en el no. 1) y dilo a ti mismo/a (doce veces)... * Ahora haz un ultimo y final deseo acerca del deseo que escogiste. * Despues de leer esto tienes 1 hora para mandarlo a 15 temas y lo que pediste se te hara realidad en 1 semana. A la mayor cantidad de gente a quien lo mandes mas fuerte se hara tu deseo. Si tu escoges ignorar esta carta lo contrario del deseo te sucedera, o esto no sucedera jamas.............. Que tus días estén llenos de logros y tus noches de sueños copia y pega esto en 15 o + tema
       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,106
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Translate Drupal from Drupalcamp Prague"

  1. 1. Translate Drupal! Gábor Hojtsy, Acquia, DrupalCamp Prague 2009
  2. 2. ME • Needed a translated Drupal in 2003 • Became locale.module maintainer, Drupal 6 core committer • Developed all kinds of translation tools • Working for Acquia
  3. 3. YOU • Running translated Drupal sites? • Translating modules for “self”? • Contributing to drupal.org translations? • Writing & translating modules to “self”?
  4. 4. TRANSLATING THE BUILT-IN INTERFACE
  5. 5. TEXT COMES FROM SOURCE CODE
  6. 6. t(‘Go to %page’, array(‘%page’ => $p)); Drupal.t(‘Go to %page’, {‘%page’: num});
  7. 7. format_plural( $count, ‘1 year’, ‘@count years’ ); Drupal.formatPlural( count, ‘1 year’, ‘@count years’ );
  8. 8. D!"#$% 6 Ch!$for new versions at hojtsy.hu – Freely redistri By Gábor Hojtsy – ion API JavaScript translat to the Translates ‘Home’ play. ion API e’) language used for page dis Core PHP translat to the Drupal.t(‘Hom Translates ‘Home’ t(‘H ome’) requested language. Plural Returns the prop er translation for Drupal.format l rules in Returns the proper (count, the text based on plura format_plural & '(%$&)*' sed e. lation for the text ba ‘1 comment’, the page’s langu ag eck ($count, trans GET THE on plural rules in the ‘@coun t comments’) ‘1 comment’, guage. ’) requested lan can be provided, ‘@count comm ents placements array Optional variable realways the page language! placements array and language is Optional variable re provided in this order. n be ix characters) language code ca ats (based on pref Replacement form value escaped with features Replaced with the ut. ns using translation Other PHP functio @count check_plain() for outp format_date Translates parts of the CHEAT SHEET +,-$& (,--&bu. ble as long as credit is kept. d value escaped an ($timesta mp, date/time formatting. Replaced with the r (theme 'medium', ...) ted as a placeholde %size format interval in (‘placeh older’)). Displays the time t l Translates value as is, withou format_interva human terms. Replaced with the ting. Insecure! Only ... ) names of the segments. ($timestamp, ional format !html any addit eady sanitized your text. provided use if you alr Formats a file size e MB, y( FROM tes. Translate s th irectory’, arra ize, ...) in by me moved to @d format_size($s Example: t(‘%na => $dirname); ta . KB and byte labels lename, ‘@dire ctory’ 1.1 - '*.-/0 ‘%name’ => $fi e code at the end. an optional languag All functions accept th e installer Translating text in ed later y as t(), but translation and us Works the same wa ckend. Use Text extracted for y ba Module/theme nam e; uses a file+memor fo files description; package na me. st(‘Home’ ) only in the installer and in install HOJTSY.HU .in support. profiles. No plural names, Literal permission d hook_per m() when provided with standar ll files and any -! 15. 2007. 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 hook_menu() ‘description’ keys , when $t(‘H ome’); depending on the fu ings. t. implem entations provided as literal str used at the momen sage, Log type and mes ral nslation, your and need to use traif your module when pr ovided as lite have an .install file ler Remember: if you easily end up running in the instal e get_t()! u’, strings. Third parameter watchdog(‘men function calls could core module in an install profile. Us calls specifies the replacements becomes a ‘Items saved’) pport. array. No plural su bal context, Usage of t() in a glo ST’, t(‘...’)). The ALSO SEE mistakes e message eg. for The most common Reuse of the sam such as define(‘CON t initialized at lues, such as t($type). d drupal_set_mes sage() t ye locale system is no e is incorrect Using dynamic va s to call watchdog() an dynamic string allows t(), the later e, so this usag Whenever you use make sure that all calls. The former dis t possible. that tim nasty performance , the above functions eady in the code is no requires t(), so this e API functions and also leads to it. possibl e values are alr I. Always ca ll the abov problems. Never do l form using the AP indirection. elsewhere in litera er provided content. directly, without us Do not translate D.O/NODE/322729 so e using the API pr operly ule plugin support, rt a ar s have coder mod po Tools to verify you Drupal 6. x-2 or later version rted in reviews. Also feel free to ex . e API is repo ings appear improper use of th ule/theme and check whether all str /project/potx od http://drupal.org template for your m e t() or some en you forgot to us nn ot find mistakes wh localization client has a The potx module ca late your output. The . If certain ot her function to trans translate text displayed on the page e API. _clie nt convenient interface to , you forg ot to use th rg/project/l10n ing up for translation http://drupal.o strings are not show
  9. 9. TEXT IS FOUND AND REPLACED RUNTIME, WHEN USED
  10. 10. Hungarian Croatian Go to %page %page. oldalra ugrás ... 1 year 1 év Uhm, not so simple @count years @count év
  11. 11. TRANSLATIONS ARE STORED IN THE DATABASE
  12. 12. DRUPAL PROCESS Running source code
  13. 13. DRUPAL PROCESS Running source code Found text stored in DB
  14. 14. DRUPAL PROCESS Running source code Found text stored in DB User interface to translate text, stored in DB
  15. 15. DRUPAL PROCESS Running source code Found text stored in DB Text replaced on User interface output to translate text, stored in DB
  16. 16. Where’s the happy family?
  17. 17. TRANSLATIONS ARE SHARED IN GETTEXT .PO
  18. 18. SHARING PROCESS
  19. 19. SHARING PROCESS
  20. 20. SHARING PROCESS Static source code
  21. 21. SHARING PROCESS Static source code Gettext .pot
  22. 22. SHARING PROCESS Static source code Gettext .pot
  23. 23. SHARING PROCESS Static source code Gettext .pot Translated .po
  24. 24. SHARING PROCESS Static source code Gettext .pot Translated .po
  25. 25. SHARING PROCESS Static source code Gettext .pot Translated .po
  26. 26. •Translation template Static extractor source code •http://drupal.org/ project/potx •Web interface in your Gettext Drupal install .pot •Interfaces with coder review module to help developers
  27. 27. SHARING PROCESS Static source code Gettext .pot Translated .po
  28. 28. SHARING PROCESS Static source code Gettext .pot Translated .po
  29. 29. Desktop tools like PoEdit or just Notepad Gettext .pot Translated .po
  30. 30. SHARING PROCESS Static source code Gettext .pot Translated .po
  31. 31. SHARING PROCESS Static source code Gettext .pot Translated .po
  32. 32. •Translation teams commit .po files to CVS •http://drupal.org/project/Translations and under contributed projects •Released on the parent project’s timeframe •Drupal imports automatically Translated .po
  33. 33. SHARING PROCESS Static source code Gettext .pot Translated .po
  34. 34. SHARING PROCESS Static source code Gettext .pot Translated .po
  35. 35. •Built-in translation interface •http://drupal.org/project/l10n_client •Import and export .po(t) files manually
  36. 36. SHARING PROCESS Static source code Gettext .pot Translated .po
  37. 37. SHARING PROCESS Static source code Gettext .pot Translated .po
  38. 38. All come together
  39. 39. GIVING AWAY (THIS WAY) IS HARD
  40. 40. POTX
  41. 41. .PO POTX
  42. 42. .PO CVS POTX
  43. 43. .PO CVS POTX RELEASES
  44. 44. .PO CVS POTX RELEASES BRANCHES
  45. 45. .PO CVS PLURAL FORMS POTX RELEASES BRANCHES
  46. 46. .PO CVS PLURAL FORMS POTX SCHEDULING RELEASES BRANCHES
  47. 47. .PO CVS PLURAL FORMS POTX SCHEDULING RELEASES BRANCHES ISSUE QUEUES
  48. 48. ENOUGH!
  49. 49. LOCALIZE.DRUPAL.ORG Web UI for Drupal.org project translations
  50. 50. LOCALIZE.DRUPAL.ORG Automated parsing of Drupal.org releases on publication
  51. 51. LOCALIZE.DRUPAL.ORG Skips CVS, branching, templates, hides potx and plural forms, does not require desktop tools
  52. 52. LOCALIZE.DRUPAL.ORG Single-sign-on with Drupal.org
  53. 53. LOCALIZE.DRUPAL.ORG Organic groups based translations
  54. 54. LOCALIZE.DRUPAL.ORG Different permission levels (open/controlled)
  55. 55. LOCALIZE.DRUPAL.ORG Keeps import/export support with Gettext formats
  56. 56. LOCALIZE.DRUPAL.ORG Provides a remote submission web service for Localization client
  57. 57. Oh, those stats!
  58. 58. almost over 5250 6900 projects known releases parsed over 159000 strings to translate
  59. 59. 159000 IT IS LIKE TRANSLATING DRUPAL 45 TIMES
  60. 60. 38 TRANSLATION TEAMS LAUNCHED ALREADY IN BETA (MORE IN QUEUE)
  61. 61. Take a ride!
  62. 62. Envious?
  63. 63. SOFTWARE ON L.D.O • Translation template extractor http://drupal.org/project/potx • Localization server: http://drupal.org/project/l10n_server • Organicgroups http://drupal.org/project/og
  64. 64. TRANSLATE YOUR CODE • Open Atrium and Gallery 2 uses Localization server to translate their code • Youcan set up l10n_server to parse your own code and translate in-house • Eg. https://translate.openatrium.com/
  65. 65. Long way to go
  66. 66. Color the future!
  67. 67. THESE SLIDES ARE (CC) Photo credits: http://www.flickr.com/photos/sinkdd/2853334715/ http://www.flickr.com/photos/chavals/2978360981/ http://www.flickr.com/photos/koesbong/125933266/ http://www.flickr.com/photos/cheishichiyo/3637712921/ http://www.flickr.com/photos/paky/52194393/ http://www.flickr.com/photos/patrickgage/3738107746/ http://www.flickr.com/photos/zhzheka/1240470939/ http://www.flickr.com/photos/fchouse/3270958643/ http://www.flickr.com/photos/colinj/490622069/ http://www.flickr.com/photos/brartist/313272029/ This presentation is © Gábor Hojtsy Licensed: http://creativecommons.org/licenses/by-nc-sa/2.0/
  68. 68. THANK YOU! Gábor Hojtsy, Acquia gabor@hojtsy.hu http://hojtsy.hu/
  1. A particular slide catching your eye?

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

×