Plone i18n, LinguaPlone

Embed Size (px)

Citation preview

Plone i18n, LinguaPlone

Vitaliy Podoba, Developer

Quintagroup, 2008

Zope/Plone i18n

Table of contents

History intro

Packages which influence i18n

Howto translate your package

Questions/Answers

History intro

No i18n

ZBabel

Localizer

PlacelessTranslationService

I18NLayer

I18NFolder

PloneLanguageTool

LinguaPlone

i18n packages

zope.i18n, zope.i18nmessageid

zope.app.i18n

Five

PlacelessTranslationservice

plone.i18n

plone.app.i18n

PloneTranslations

PloneLanguageTool

CMPPlone

Addon translation

Keep your code translatable:

Addon translation domain

Page Template translation

Python code translation

GS profile translation

Translation files

Translation domain

from zope.i18nmessageid import MessageFactory

PloneMessageFactory = MessageFactory('plone')

Page Template translation

...

...

...

Welcome to Plone.

Welcome to Plone.

There have been over

100,000

downloads of Plone.

There have been ${count} downloads of Plone.

Python code translation

from Products.CMFPlone import PloneMessageFactory as _

return _(u"Welcome to Plone")

from Products.CMFPlone import PloneMessageFactory as _

return _(u"welcome_to_plone",

default="Welcome to Plone, ${date}",

mapping={'date':'2008-08-08'})

ts = getToolByName(context, 'translation_service')

return ts.translate('domain',

'msgid',

context,

{'date':'2008-08-08'},

target_language='en',

default='Default message')

GS Profile Translation

See Page Template Translation section

Translation files

Translation Tools

I18ndude

i18nextract.py

PloneTranslations utils

poEdit

i18ndude rebuild-pot --pot locales/mydomain.pot --create mydomain .

i18ndude sync --pot locales/mydomain.pot locales/*/LC_MESSAGES/mydomain.po

i18ndude

#. Default: "Site News"

msgid "news-description"

msgstr ""

#. Default: "Events"

msgid "events-title"

msgstr ""

POT Example

Compile po files

# Compile po files

for lang in $(find locales -mindepth 1 -maxdepth 1 -type d); do

if test -d $lang/LC_MESSAGES; then

msgfmt -o $lang/LC_MESSAGES/${PRODUCTNAME}.mo $lang/LC_MESSAGES/${PRODUCTNAME}.po

fi

done

Register translation

Questions/Answers

LinguaPlone

Table of contents

LinguaPlone Features

UI

LinguaPlone Internals

Questions/Answers

Features

Totally transparent, install-and-go

Each translation is a discrete object, and can be workflowed individually

Translations are kept track of using AT references

Even if you uninstall LinguaPlone after adding multilingual content, all your content will be intact and will work as separate objects

Features

Supporting multilingual capabilities is a 4 (!) line addition to your Archetypes class

Fully integrated with ATContentTypes, so the basic content types are translatable

Supports language-independent fields

Uses the notion of Canonical versions

LinguaPlone doesn't require a particular hierarchy of content

UI

Languages Control Panel

'Translate into' pulldown menu

Translation Form

Manage Translations Form

Language Selector Viewlet

Language Portlet

Languages Configlet

Translate into menu

Translation Form

Translation Form

Manage Translations
Form

Manage Translations
Form

Language Selector
Viewlet

Language Portlet

Internals

Patches: publisher, catalog, kupu

LanguageIndex: Language

languageIndependent=True

AT references: translationOf

Delete protection, off by default

Translation id: -lang_code

Multilingual support for
your content types

try:

from Products.LinguaPlone.public import *

except ImportError:

# No multilingual support

from Products.Archetypes.public import *

Questions/Answers

The End

Click to edit the title text format