Your SlideShare is downloading. ×
Multilingual drupal 7
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Multilingual drupal 7

3,539
views

Published on

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

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

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Multilingual Drupal 7 Drupal Camp ZP
  • 2. About MePavel MakhrinskyDrupal Developer in Berlingske Mediahttp://drupal.org/user/773216•
  • 3. Multilingual types• LocalizedSingle language site• Multilingual siteSite with different content for different languages• Multilingual site with translationSite with translated content•
  • 4. Translatable items Strings Menus ContentVariables Entities
  • 5. Configuration• Core modules – Locale – Content translate• Custom modules – i18n (Internalization) – l10n (Localization helper modules) – Entity translation••
  • 6. Language handlingLanguage detectionUser interface translationLocale
  • 7. Locale: languages admin/config/regional/language
  • 8. Locale: language detection admin/config/regional/language/configure
  • 9. Locale: string translation
  • 10. localize.drupal.orgLocalization clientLocalization serverLocalization updateCommunity translations
  • 11. localize.drupal.org
  • 12. Translation update workflow
  • 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. t(), format_plural()ContextTranslating strings
  • 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. 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. t(): examples
  • 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. 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. format_plural(): examples
  • 21. Context• The way to describe string• Works for – t() – format_plural() – Drupal.t() – Drupal.formatPlural() Drupal 6 Drupal 7 Представления Представления Views Views ? Просмотры Просмотры
  • 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. Context: examples
  • 24. Translating nodesTranslating fieldsTranslating content
  • 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. Node translation: configuration Modules• Modules: – Locale – Content translation• Additional modules: – Internalization – Multilingual content – Multilingual select – Synchronize translations – Translation redirect
  • 27. Node translation: configuration Content type
  • 28. Node translation: configuration i18n: Multilingual content
  • 29. Node translation: translation
  • 30. Node translation: configuration i18n: Multilingual select
  • 31. Node translation: configuration i18n: Multilingual select
  • 32. Entity translation: configuration Modules• Modules: – Locale – Entity translation• Additional modules: – Title•
  • 33. Entity translation: configuration Settings
  • 34. Entity translation: configuration Node creation
  • 35. The waysi18nUsage of contextMenu
  • 36. Internalization: Menu translation
  • 37. Separate menus English Russian Node NodeNode item (en) (ru) Node item LinkMenu router (home, Menu router item default pages) item
  • 38. One menu, content translationNode item Node item Menu routerIn English In Russian item Node Node Link (en) (ru) (home, default pages)
  • 39. One menu, entity translation Node item Menu router Localized item Language neutral Node Link (en) (home, default pages)
  • 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. Menu: adding context
  • 42. BlocksVariablesField propertiesMiscellanious items
  • 43. Block: Block languages
  • 44. Variables: Variable translation
  • 45. Field settings: Field translation
  • 46. Localization updateLocalization clientTranslation overviewUseful Modules
  • 47. Localization update
  • 48. Localization client
  • 49. Translation overview
  • 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. Questions? Pavel Makhrinsky Skype: gumanista

×