advertisement

Plone i18n, LinguaPlone

75 %
25 %
advertisement
Information about Plone i18n, LinguaPlone

Published on September 16, 2008

Author: Quintagroup

Source: slideshare.net

Description

History intro, Packages which influence i18n, How to translate your package
advertisement

Plone i18n, LinguaPlone Vitaliy Podoba, Developer © Quintagroup, 2008

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

Packages which influence i18n

Howto translate your package

Questions/Answers

History intro No i18n ZBabel Localizer PlacelessTranslationService I18NLayer I18NFolder PloneLanguageTool LinguaPlone

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

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

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')

from zope.i18nmessageid import MessageFactory

PloneMessageFactory = MessageFactory('plone')

Page Template translation <html ... xmlns:i18n=&quot; http://xml.zope.org/namespaces/i18n &quot; i18n:domain=&quot;plone&quot;> ... <div i18n:domain=&quot;some.other.domain&quot;>...</div> ... </html>

<html ...

xmlns:i18n=&quot; http://xml.zope.org/namespaces/i18n &quot;

i18n:domain=&quot;plone&quot;>

...

<div i18n:domain=&quot;some.other.domain&quot;>...</div>

...

</html>

<p i18n:translate=&quot;msg_id&quot;>Welcome to Plone.</p> <p i18n:translate=&quot;&quot;>Welcome to Plone.</p>

<p i18n:translate=&quot;msg_id&quot;>Welcome to Plone.</p>

<p i18n:translate=&quot;&quot;>Welcome to Plone.</p>

<img src=&quot;plone.gif&quot; alt=&quot;Plone Icon&quot; title=&quot;Plone Icon Title&quot; i18n:attributes=&quot;alt title&quot;> <img src=&quot;plone.gif&quot; alt=&quot;Plone Icon&quot; title=&quot;Plone Icon Title&quot; i18n:attributes=&quot;alt plone-icon; title plone-icon-title&quot;>

<img src=&quot;plone.gif&quot;

alt=&quot;Plone Icon&quot;

title=&quot;Plone Icon Title&quot;

i18n:attributes=&quot;alt title&quot;>

<img src=&quot;plone.gif&quot;

alt=&quot;Plone Icon&quot;

title=&quot;Plone Icon Title&quot;

i18n:attributes=&quot;alt plone-icon;

title plone-icon-title&quot;>

<p i18n:translate=&quot;&quot;>There have been over <span tal:content=&quot;here/download_count&quot; i18n:name=&quot;count&quot;>100,000</span> downloads of Plone. </p> There have been ${count} downloads of Plone.

<p i18n:translate=&quot;&quot;>There have been over

<span tal:content=&quot;here/download_count&quot;

i18n:name=&quot;count&quot;>100,000</span>

downloads of Plone.

</p>

Python code translation from Products.CMFPlone import PloneMessageFactory as _ return _(u&quot;Welcome to Plone&quot;) from Products.CMFPlone import PloneMessageFactory as _ return _(u&quot;welcome_to_plone&quot;, default=&quot;Welcome to Plone, ${date}&quot;, mapping={'date':'2008-08-08'})

from Products.CMFPlone import PloneMessageFactory as _

return _(u&quot;Welcome to Plone&quot;)

from Products.CMFPlone import PloneMessageFactory as _

return _(u&quot;welcome_to_plone&quot;,

default=&quot;Welcome to Plone, ${date}&quot;,

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')

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

See Page Template Translation section

Translation files

Translation Tools I18ndude i18nextract.py PloneTranslations utils poEdit

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

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

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

#. Default: &quot;Site News&quot; msgid &quot;news-description&quot; msgstr &quot;&quot; #. Default: &quot;Events&quot; msgid &quot;events-title&quot; msgstr &quot;&quot; POT Example

#. Default: &quot;Site News&quot;

msgid &quot;news-description&quot;

msgstr &quot;&quot;

#. Default: &quot;Events&quot;

msgid &quot;events-title&quot;

msgstr &quot;&quot;

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

# 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 <configure xmlns:i18n=&quot;http://namespaces.zope.org/i18n&quot;> <i18n:registerTranslations directory=&quot;locales&quot; /> </configure>

<configure

xmlns:i18n=&quot;http://namespaces.zope.org/i18n&quot;>

<i18n:registerTranslations directory=&quot;locales&quot; />

</configure>

Questions/Answers

LinguaPlone

Table of contents LinguaPlone Features UI LinguaPlone Internals Questions/Answers

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

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

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 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: <orig_id>-lang_code

Patches: publisher, catalog, kupu

LanguageIndex: Language

languageIndependent=True

AT references: translationOf

Delete protection, off by default

Translation id: <orig_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 *

try:

from Products.LinguaPlone.public import *

except ImportError:

# No multilingual support

from Products.Archetypes.public import *

Questions/Answers

The End

Add a comment

Related pages

LinguaPlone — Plone CMS: Open Source Content Management

Install LinguaPlone into your Plone environment by adding it to the buildout or adding it as a dependency ... The change requires plone.app.i18n 2.0.1 or ...
Read more

LinguaPlone — Plone-Entwicklerhandbuch

Um LinguaPlone ordnungsgemäß in einer Plone-Site aktivieren zu können, muss folgende Reihenfolge eingehalten werden: Zunächst muss die Sprachauswahl im ...
Read more

Linguaplone references lost — Plone CMS: Open Source ...

Plone 2.1.2 Python 2.3.5 Windows ... i18n_domain ='Employee', ... We seem to have lost Linguaplone references for some of our custom content types and ...
Read more

Plone / Mailing Lists - SourceForge - Download, Develop ...

[Plone-i18n] Re: LinguaPlone and Portal Tabs. From: - 2004-11-23 13:40:43. Hello, Massimo Sabbatini wrote: > > Alexander Limi wrote ...
Read more

Plone / Mailing Lists - SourceForge - Download, Develop ...

Hello, my site uses plone 2.5.2, has PloneLanguageTool and LinguaPlone installed = and is currently set up for four languages. However, it is only partly ...
Read more

Translated content — Plone Documentation v5.0

Translating content items in Plone, ... (same as in previous version of Plone with LinguaPlone in place): ... (i18n) Translated content; Previous;
Read more

Multilingual Plone Site, Using LinguaPlone for Content ...

Multilingual site creation with Plone default features and additional tools. This article applies to: Plone 3.0, Plone 2.5, Plone 2.1.
Read more

internationalization - How to translate i18n Plone actions ...

If your contact / kontakt content is multilingual content managed by LinguaPlone, you can use the takeaction add-on to create one action that'll switch ...
Read more

plone.app.i18n 2.0b1 : Python Package Index

Download plone.app.i18n-2.0b1.zip. Plone specific i18n extensions ... 2.0b1 - 2010-04-10. Updated language selector markup to match the one in LinguaPlone.
Read more