Patrick Smith wrote:
> We are using Plone to create Document Management System
and I am trying
> to translate the strings in the DMS. So far I have been
unable to
> replace the strings in the script with the msgstr in
the .po file.
>
> Here is what I have:
>
> [1] OpenEngagementDMS-fr.po file in E:Plone
> 2DataProductsOpenEngagementDMSi18n containing:
>
> msgid ""
> msgstr ""
> "Project-Id-Version: PACKAGE VERSIONn"
> "POT-Creation-Date: 2006-11-03 21:07+0000n"
> "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONEn"
> "Last-Translator: FULL NAME <EMAIL ADDRESS>n"
> "Language-Team: LANGUAGE <LL li.org>n"
> "MIME-Version: 1.0n"
> "Content-Type: text/plain; charset=utf-8n"
> "Content-Transfer-Encoding: 8bitn"
> "Plural-Forms: nplurals=2; plural=(n >
1);n"
> "Language-Code: frn"
> "Language-Name: Frenchn"
> "Preferred-Encodings: utf-8 latin1n"
> "Domain: OpenEngagementDMSn"
>
> #: E:Plone
>
2DataProductsOpenEngagementDMSExtensionsdmsobject_workf
low_scripts.
> py:148
> msgid "Reviewer"
> msgstr "Stooge"
>
> [2] E:Plone
2DataProductsOpenEngagementDMS__init__.py which
> contains:
>
> from zope.i18nmessageid import MessageFactory
> DMSMessageFactory = MessageFactory('OpenEngagementDMS')
> #DMSMessageFactory = lambda s, default=None,
mapping=None: u'hot
> chocolate!!!!'
> from AccessControl import ModuleSecurityInfo
>
ModuleSecurityInfo('Products.OpenEngagementDMS').declarePubl
ic('DMSMessa
> geFactory')
>
> [3] a python script (dmsobject_workflow_scripts.py)
containing the
> following bits:
>
> ...
> from Products.OpenEngagementDMS import
DMSMessageFactory as _
> ...
> emailedRole = _(u'Reviewer')
> ...
>
>
============================================================
=====
>
> Now, I can verify using the PlacelessTranslationService
via the ZMI's
> Control Panel that OpenEngagementDMS-fr.po gets loaded
as
> OpenEngagementDMS.i18n-openengagementdms-fr.po (fr
language (French) for
> OpenEngagementDMS). I can us the Test tab to verify
that Stooge is the
> msgstr for the msgid Reviewer.
>
> When I change the Firefox settings to display
French/France as its
> topmost preference, the translations happen as expected
for the site's
> underlying ploneness but not those for my python
scripts.
>
> I can edit __init__.py so that it blindly replaces all
string lookups
> with the static 'hot chocalate' (you'll note the
commented out line
> above) and I can verifiy that that static string is
displayed in the web
> browser.
>
> Can someone let me know if I am missing a step? It
seems like everything
> is in place but the MessageFactory is not going to the
.po file that has
> been loaded by the PTS to lookup the substitution
string. I'm not sure
> why not.
>
> Any help is appreciated. Thank you.
> Patrick Smith
I am pretty much in the same situation as patrick, what I
have been able to
verify that if I have a:
my_custom_product/skins/somePythonScript.py:
------------------------------------------------------------
-------------------
from Products.CMFPlone import PloneMessageFactory as _
msg = _(u'Login failed')
------------------------------------------------------------
-------------------
It will not work, but if I modify
CMFPlone/skins/plone_scripts/addtoFavorites.py, such that it
uses the
message factory from my custom product:
------------------------------------------------------------
-------------------
from Products.my_custom_product import myMsgFactory as _
context.plone_utils.addPortalMessage(_(u'my_custom_msg'))
------------------------------------------------------------
-------------------
This works fine.
Could this be due to some permission issues with my python
script,
I would really appreciate any help I could get, this is
driving me nuts.
Thanks
Vishal Vatsa
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-i18n mailing list
Plone-i18n lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-i18n
a>
|