SlideShare une entreprise Scribd logo
1  sur  68
Télécharger pour lire hors ligne
Translate Drupal!
Gábor Hojtsy, Acquia, DrupalCamp Vienna 2009
TRANSLATING
THE BUILT-IN
 INTERFACE
TEXT COMES
    FROM
SOURCE CODE
t(‘Go to %page’,
array(‘%page’ => $p));


Drupal.t(‘Go to %page’,
       {‘%page’: num});
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
TEXT IS FOUND
 AND REPLACED
RUNTIME, WHEN
     USED
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 interface
                to translate text,
                  stored in DB
DRUPAL PROCESS
   Running
 source code
                      Found text
                     stored in DB


Text replaced on    User interface
     output        to translate text,
                     stored in DB
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
                  .pot (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
•Translation template            Static
 extractor                    source code
•http://drupal.org/
 project/potx
•Web interface in your         Gettext
 Drupal install               .pot (CVS)
•Coder review (incl. drush)
 support for module
 syntax checking
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
Desktop tools like
PoEdit or just Notepad



                          Gettext
                         .pot (CVS)


                         Translated
                          .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
•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 (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


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


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
SHARING PROCESS
                     Static
                  source code


                   Gettext
                  .pot (CVS)


                  Translated
                   .po (CVS)
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
                    Static
                 source code


                  Gettext
                 .pot (CVS)


                 Translated
                  .po (CVS)
LOCALIZE.DRUPAL.ORG
                    Static
                 source code


                  Gettext
                  Database
                 .pot (CVS)


                 Translated
                  .po (CVS)
LOCALIZE.DRUPAL.ORG
                    Static
                 source code
                   Automation



                  Gettext
                  Database
                 .pot (CVS)


                 Translated
                  .po (CVS)
LOCALIZE.DRUPAL.ORG
                    Static
                 source code
                   Automation



                  Gettext
                  Database
                 .pot (CVS)
                    Web UI




                 Translated
                  .po (CVS)
LOCALIZE.DRUPAL.ORG
                    Static
                 source code
                   Automation



                  Gettext
                  Database
                 .pot (CVS)
                    Web UI




                 Translated
                  .po (CVS)
                       (FTP)
LOCALIZE.DRUPAL.ORG
                    Static
                 source code
                   Automation



                  Gettext
                  Database
                 .pot (CVS)
                    Web UI

                   Automation


                 Translated
                  .po (CVS)
                       (FTP)
LOCALIZE.DRUPAL.ORG
                         Static
                      source code
                        Automation



                       Gettext
                       Database
                      .pot (CVS)
                         Web UI

                        Automation


                      Translated
               Pull    .po (CVS)
                            (FTP)
LOCALIZE.DRUPAL.ORG
                         Static
                      source code
                        Automation



                       Gettext
                       Database
                      .pot (CVS)
                         Web UI

                        Automation


                      Translated
               Pull    .po (CVS)
                            (FTP)
LOCALIZE.DRUPAL.ORG
                          Static
                       source code
                           Automation



                        Gettext
                        Database
                       .pot (CVS)
                          Web UI
              Contribute
                           Automation


                       Translated
                Pull    .po (CVS)
                             (FTP)
LOCALIZE.DRUPAL.ORG
                          Static
                       source code
                           Automation



                        Gettext
                        Database
                       .pot (CVS)
                          Web UI
              Contribute
                           Automation


                       Translated
                Pull    .po (CVS)
                             (FTP)
Oh, those stats!
over                                almost


5410                               7700
projects known                      releases parsed

                        over



    165000       strings to translate
165000
  IT IS LIKE
TRANSLATING
   DRUPAL
  45 TIMES
44
  TRANSLATION
TEAMS LAUNCHED
ALREADY IN BETA
(MORE IN QUEUE)
ALMOST

  600
CONTRIBUTORS
  SUBMITTED
TRANSLATIONS
Take a ride!
CONTRIBUTE!

• LocalizedDrupal install profile (dev!)
 http://drupal.org/project/l10n_install

• Localization
             client:
 http://drupal.org/project/l10n_client

• Developer help needed:
 http://drupal.org/projects/issues/
 search?issue_tags=ldodomination
Envious?
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
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/
Long way to go
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/
THANK YOU!
 Gábor Hojtsy, Acquia
  gabor@hojtsy.hu
   http://hojtsy.hu/

Contenu connexe

Similaire à Translate Drupal from Drupalcamp Vienna

Unsupervised analysis for decipherment problems
Unsupervised analysis for decipherment problemsUnsupervised analysis for decipherment problems
Unsupervised analysis for decipherment problemsAttaporn Ninsuwan
 
Model-Driven Software Development - Language Workbenches & Syntax Definition
Model-Driven Software Development - Language Workbenches & Syntax DefinitionModel-Driven Software Development - Language Workbenches & Syntax Definition
Model-Driven Software Development - Language Workbenches & Syntax DefinitionEelco Visser
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsRoy Zimmer
 
Manipulating strings
Manipulating stringsManipulating strings
Manipulating stringsNicole Ryan
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++Neeru Mittal
 
HC - The Mobile Adventure with Phonegap
HC - The Mobile Adventure with PhonegapHC - The Mobile Adventure with Phonegap
HC - The Mobile Adventure with Phonegaphockeycommunity
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionskeeyre
 

Similaire à Translate Drupal from Drupalcamp Vienna (13)

Nate tech deck
Nate tech deckNate tech deck
Nate tech deck
 
Pdf sample3
Pdf sample3Pdf sample3
Pdf sample3
 
Php Learning show
Php Learning showPhp Learning show
Php Learning show
 
10 Jo P Oct 07
10 Jo P Oct 0710 Jo P Oct 07
10 Jo P Oct 07
 
Unsupervised analysis for decipherment problems
Unsupervised analysis for decipherment problemsUnsupervised analysis for decipherment problems
Unsupervised analysis for decipherment problems
 
Model-Driven Software Development - Language Workbenches & Syntax Definition
Model-Driven Software Development - Language Workbenches & Syntax DefinitionModel-Driven Software Development - Language Workbenches & Syntax Definition
Model-Driven Software Development - Language Workbenches & Syntax Definition
 
429 e8d01
429 e8d01429 e8d01
429 e8d01
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager Needs
 
Manipulating strings
Manipulating stringsManipulating strings
Manipulating strings
 
Cheatsheet
CheatsheetCheatsheet
Cheatsheet
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++
 
HC - The Mobile Adventure with Phonegap
HC - The Mobile Adventure with PhonegapHC - The Mobile Adventure with Phonegap
HC - The Mobile Adventure with Phonegap
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 

Plus de Gábor Hojtsy

Open source project management at scale
 Open source project management at scale Open source project management at scale
Open source project management at scaleGábor Hojtsy
 
Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?Gábor Hojtsy
 
Drupal 8 multilingual APIs
Drupal 8 multilingual APIsDrupal 8 multilingual APIs
Drupal 8 multilingual APIsGábor Hojtsy
 
A Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető útA Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető útGábor Hojtsy
 
Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Gábor Hojtsy
 
Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Gábor Hojtsy
 
All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014Gábor Hojtsy
 
Drupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toDrupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toGábor Hojtsy
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonGábor Hojtsy
 
Doing Drupal security right
Doing Drupal security rightDoing Drupal security right
Doing Drupal security rightGábor Hojtsy
 
Drupal security - Configuration and process
Drupal security - Configuration and processDrupal security - Configuration and process
Drupal security - Configuration and processGábor Hojtsy
 
Come for the software, stay for the community
Come for the software, stay for the communityCome for the software, stay for the community
Come for the software, stay for the communityGábor Hojtsy
 
Come for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesCome for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesGábor Hojtsy
 
Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009Gábor Hojtsy
 
What's up with Drupal 7?
What's up with Drupal 7?What's up with Drupal 7?
What's up with Drupal 7?Gábor Hojtsy
 
Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Gábor Hojtsy
 

Plus de Gábor Hojtsy (17)

Open source project management at scale
 Open source project management at scale Open source project management at scale
Open source project management at scale
 
Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?
 
Drupal 8 multilingual APIs
Drupal 8 multilingual APIsDrupal 8 multilingual APIs
Drupal 8 multilingual APIs
 
A Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető útA Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető út
 
Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Everything multilingual in Drupal 8
Everything multilingual in Drupal 8
 
Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)
 
All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014
 
Drupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toDrupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward to
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
 
Multilingual Drupal
Multilingual DrupalMultilingual Drupal
Multilingual Drupal
 
Doing Drupal security right
Doing Drupal security rightDoing Drupal security right
Doing Drupal security right
 
Drupal security - Configuration and process
Drupal security - Configuration and processDrupal security - Configuration and process
Drupal security - Configuration and process
 
Come for the software, stay for the community
Come for the software, stay for the communityCome for the software, stay for the community
Come for the software, stay for the community
 
Come for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesCome for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolves
 
Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009
 
What's up with Drupal 7?
What's up with Drupal 7?What's up with Drupal 7?
What's up with Drupal 7?
 
Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"
 

Dernier

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 

Dernier (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 

Translate Drupal from Drupalcamp Vienna

  • 1. Translate Drupal! Gábor Hojtsy, Acquia, DrupalCamp Vienna 2009
  • 3. TEXT COMES FROM SOURCE CODE
  • 4. t(‘Go to %page’, array(‘%page’ => $p)); Drupal.t(‘Go to %page’, {‘%page’: num});
  • 5. 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
  • 6. TEXT IS FOUND AND REPLACED RUNTIME, WHEN USED
  • 7. TRANSLATIONS ARE STORED IN THE DATABASE
  • 8. DRUPAL PROCESS Running source code
  • 9. DRUPAL PROCESS Running source code Found text stored in DB
  • 10. DRUPAL PROCESS Running source code Found text stored in DB User interface to translate text, stored in DB
  • 11. DRUPAL PROCESS Running source code Found text stored in DB Text replaced on User interface output to translate text, stored in DB
  • 13. TRANSLATIONS ARE SHARED IN GETTEXT .PO
  • 16. SHARING PROCESS Static source code
  • 17. SHARING PROCESS Static source code Gettext .pot (CVS)
  • 18. SHARING PROCESS Static source code Gettext .pot (CVS)
  • 19. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 20. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 21. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 22. •Translation template Static extractor source code •http://drupal.org/ project/potx •Web interface in your Gettext Drupal install .pot (CVS) •Coder review (incl. drush) support for module syntax checking
  • 23. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 24. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 25. Desktop tools like PoEdit or just Notepad Gettext .pot (CVS) Translated .po (CVS)
  • 26. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 27. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 28. •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 (CVS)
  • 29. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 30. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 32. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 33. SHARING PROCESS Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 35. GIVING AWAY (THIS WAY) IS HARD
  • 36.
  • 37. POTX
  • 42. .PO CVS PLURAL FORMS POTX RELEASES BRANCHES
  • 43. .PO CVS PLURAL FORMS POTX SCHEDULING RELEASES BRANCHES
  • 44. .PO CVS PLURAL FORMS POTX SCHEDULING RELEASES BRANCHES ISSUE QUEUES
  • 46. LOCALIZE.DRUPAL.ORG Static source code Gettext .pot (CVS) Translated .po (CVS)
  • 47. LOCALIZE.DRUPAL.ORG Static source code Gettext Database .pot (CVS) Translated .po (CVS)
  • 48. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Translated .po (CVS)
  • 49. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Translated .po (CVS)
  • 50. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Translated .po (CVS) (FTP)
  • 51. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Automation Translated .po (CVS) (FTP)
  • 52. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Automation Translated Pull .po (CVS) (FTP)
  • 53. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Automation Translated Pull .po (CVS) (FTP)
  • 54. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Contribute Automation Translated Pull .po (CVS) (FTP)
  • 55. LOCALIZE.DRUPAL.ORG Static source code Automation Gettext Database .pot (CVS) Web UI Contribute Automation Translated Pull .po (CVS) (FTP)
  • 57. over almost 5410 7700 projects known releases parsed over 165000 strings to translate
  • 58. 165000 IT IS LIKE TRANSLATING DRUPAL 45 TIMES
  • 59. 44 TRANSLATION TEAMS LAUNCHED ALREADY IN BETA (MORE IN QUEUE)
  • 60. ALMOST 600 CONTRIBUTORS SUBMITTED TRANSLATIONS
  • 62. CONTRIBUTE! • LocalizedDrupal install profile (dev!) http://drupal.org/project/l10n_install • Localization client: http://drupal.org/project/l10n_client • Developer help needed: http://drupal.org/projects/issues/ search?issue_tags=ldodomination
  • 64. 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
  • 65. 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/
  • 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. THANK YOU! Gábor Hojtsy, Acquia gabor@hojtsy.hu http://hojtsy.hu/