0
Multilingual Drupal 7    Drupal Camp ZP
About MePavel MakhrinskyDrupal Developer in Berlingske Mediahttp://drupal.org/user/773216•
Multilingual types• LocalizedSingle language site• Multilingual siteSite with different content for different languages• M...
Translatable items                                 Strings                                 Menus                          ...
Configuration• Core modules    – Locale    – Content translate• Custom modules    – i18n (Internalization)    – l10n (Loca...
Language handlingLanguage detectionUser interface translationLocale
Locale: languages  admin/config/regional/language
Locale: language detection   admin/config/regional/language/configure
Locale: string translation
localize.drupal.orgLocalization clientLocalization serverLocalization updateCommunity translations
localize.drupal.org
Translation update workflow
Language types• Interface language          – t()          – format_plural()• Content language *          – Used for Field...
t(), format_plural()ContextTranslating strings
t(): variations• t()if your code will never run during the Drupal installation phase• st()if your code will only run durin...
t(): callingParameters• $string• $args     – @argument – processed via check_plain()     – %argument – processed via drupa...
t(): examples
format_plural(): parametersParameters• $count• $singular• $plural• $args      – @argument – processed via check_plain()   ...
format_plural(): russian• Add configuration to .po file"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?" "...
format_plural(): examples
Context• The way to describe string• Works for      –    t()      –    format_plural()      –    Drupal.t()      –    Drup...
JavaScript• Drupal.t()1 // Drupal 7.10+2 shortMay = Drupal.t(May);3 longMay = Drupal.t(May, {}, {context: "Long month name...
Context: examples
Translating nodesTranslating fieldsTranslating content
Translation types    Node translation            Field translationBase                                                    ...
Node translation: configuration                     Modules• Modules:     – Locale     – Content translation• Additional m...
Node translation: configuration           Content type
Node translation: configuration      i18n: Multilingual content
Node translation: translation
Node translation: configuration       i18n: Multilingual select
Node translation: configuration       i18n: Multilingual select
Entity translation: configuration                      Modules• Modules:     – Locale     – Entity translation• Additional...
Entity translation: configuration             Settings
Entity translation: configuration           Node creation
The waysi18nUsage of contextMenu
Internalization: Menu translation
Separate menus  English                                         Russian                Node                    NodeNode it...
One menu, content translationNode item    Node item    Menu routerIn English   In Russian      item  Node         Node    ...
One menu, entity translation       Node item                       Menu router        Localized                          i...
Menu: adding context 1 function multilingual_menu() { 2   $items = array(); 3 4   $items[yabadabadu] = array( 5      page ...
Menu: adding context
BlocksVariablesField propertiesMiscellanious items
Block: Block languages
Variables: Variable translation
Field settings: Field translation
Localization updateLocalization clientTranslation overviewUseful Modules
Localization update
Localization client
Translation overview
Links•   http://hojtsy.hu/files/Drupal7TranslationCheatSheetv2.pdf•   http://hojtsy.hu/multilingual-drupal7•   http://api....
Questions?  Pavel Makhrinsky  Skype: gumanista
Upcoming SlideShare
Loading in...5
×

Multilingual drupal 7

3,590

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,590
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Multilingual drupal 7"

  1. 1. Multilingual Drupal 7 Drupal Camp ZP
  2. 2. About MePavel MakhrinskyDrupal Developer in Berlingske Mediahttp://drupal.org/user/773216•
  3. 3. Multilingual types• LocalizedSingle language site• Multilingual siteSite with different content for different languages• Multilingual site with translationSite with translated content•
  4. 4. Translatable items Strings Menus ContentVariables Entities
  5. 5. Configuration• Core modules – Locale – Content translate• Custom modules – i18n (Internalization) – l10n (Localization helper modules) – Entity translation••
  6. 6. Language handlingLanguage detectionUser interface translationLocale
  7. 7. Locale: languages admin/config/regional/language
  8. 8. Locale: language detection admin/config/regional/language/configure
  9. 9. Locale: string translation
  10. 10. localize.drupal.orgLocalization clientLocalization serverLocalization updateCommunity translations
  11. 11. localize.drupal.org
  12. 12. Translation update workflow
  13. 13. Language types• Interface language – t() – format_plural()• Content language * – Used for Field API – Used for content translation• URL language * – l()•Not configurable by core
  14. 14. t(), format_plural()ContextTranslating strings
  15. 15. t(): variations• t()if your code will never run during the Drupal installation phase• st()if your code will only run during installation and never any othertime• get_t()if your code could run in either circumstance
  16. 16. t(): callingParameters• $string• $args – @argument – processed via check_plain() – %argument – processed via drupal_placeholder() – !argument – inserted as is.• $options – context – context for string – langcode – language code, default current language
  17. 17. t(): examples
  18. 18. format_plural(): parametersParameters• $count• $singular• $plural• $args – @argument – processed via check_plain() – %argument – processed via drupal_placeholder() – !argument – inserted as is.• $options – context – context for string – langcode – language code, default current language
  19. 19. format_plural(): russian• Add configuration to .po file"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?" "(0):(((((n%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));"• Add translationmsgid "1 comment"msgid_plural "@count comments"msgstr[0] "@count комментарий"msgstr[1] "@count комментария"msgstr[2] "@count[2] комментариев"
  20. 20. format_plural(): examples
  21. 21. Context• The way to describe string• Works for – t() – format_plural() – Drupal.t() – Drupal.formatPlural() Drupal 6 Drupal 7 Представления Представления Views Views ? Просмотры Просмотры
  22. 22. JavaScript• Drupal.t()1 // Drupal 7.10+2 shortMay = Drupal.t(May);3 longMay = Drupal.t(May, {}, {context: "Long month name"});45 // Drupal 7.9-6 shortMay = Drupal.t(May);7 longMay = .... not possible in JS ....;• Drupal.formatPlural()1 var n = 32 Drupal.formatPlural(n, 1 comment, [@count] comments, {},{context: "Tricky comments"});
  23. 23. Context: examples
  24. 24. Translating nodesTranslating fieldsTranslating content
  25. 25. Translation types Node translation Field translationBase runode Title en (ru) Entity uk Node (default language) (en) ru Body enNode Price Photo uk (uk) (und) (und)
  26. 26. Node translation: configuration Modules• Modules: – Locale – Content translation• Additional modules: – Internalization – Multilingual content – Multilingual select – Synchronize translations – Translation redirect
  27. 27. Node translation: configuration Content type
  28. 28. Node translation: configuration i18n: Multilingual content
  29. 29. Node translation: translation
  30. 30. Node translation: configuration i18n: Multilingual select
  31. 31. Node translation: configuration i18n: Multilingual select
  32. 32. Entity translation: configuration Modules• Modules: – Locale – Entity translation• Additional modules: – Title•
  33. 33. Entity translation: configuration Settings
  34. 34. Entity translation: configuration Node creation
  35. 35. The waysi18nUsage of contextMenu
  36. 36. Internalization: Menu translation
  37. 37. Separate menus English Russian Node NodeNode item (en) (ru) Node item LinkMenu router (home, Menu router item default pages) item
  38. 38. One menu, content translationNode item Node item Menu routerIn English In Russian item Node Node Link (en) (ru) (home, default pages)
  39. 39. One menu, entity translation Node item Menu router Localized item Language neutral Node Link (en) (home, default pages)
  40. 40. Menu: adding context 1 function multilingual_menu() { 2 $items = array(); 3 4 $items[yabadabadu] = array( 5 page callback => multilingual_yabadabadu_page, 6 access callback => TRUE, 7 type => MENU_NORMAL_ITEM, 8 menu_name => main-menu, 910 title => Ya-ba-da-ba-du !test,11 title callback => multilingual_title_callback,12 title arguments => array(),13 );1415 return $items;16 }1 function multilingual_title_callback() {2 return t(Overwritten !test,3 array(!test => ya-ba-da-ba-du),4 array(context => Multilingual)5 );6 }
  41. 41. Menu: adding context
  42. 42. BlocksVariablesField propertiesMiscellanious items
  43. 43. Block: Block languages
  44. 44. Variables: Variable translation
  45. 45. Field settings: Field translation
  46. 46. Localization updateLocalization clientTranslation overviewUseful Modules
  47. 47. Localization update
  48. 48. Localization client
  49. 49. Translation overview
  50. 50. Links• http://hojtsy.hu/files/Drupal7TranslationCheatSheetv2.pdf• http://hojtsy.hu/multilingual-drupal7• http://api.drupal.org/api/drupal/includes!common.inc/group/sanit• http://api.drupal.org/api/drupal/modules!field!field.multilingual.in•
  51. 51. Questions? Pavel Makhrinsky Skype: gumanista
  1. A particular slide catching your eye?

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

×