Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
088be37b
Commit
088be37b
authored
Jun 22, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into ivan
parents
1574192a
f49d7b7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
product/Localizer/Localizer.py
product/Localizer/Localizer.py
+2
-2
product/Localizer/MessageCatalog.py
product/Localizer/MessageCatalog.py
+15
-3
No files found.
product/Localizer/Localizer.py
View file @
088be37b
...
...
@@ -31,7 +31,7 @@ from ZPublisher.BeforeTraverse import registerBeforeTraverse, \
# Import Localizer modules
from
interfaces
import
ILocalizer
from
LocalFiles
import
LocalDTMLFile
from
MessageCatalog
import
MessageCatalog
from
MessageCatalog
import
MessageCatalog
,
to_unicode
from
utils
import
lang_negotiator
from
LanguageManager
import
LanguageManager
...
...
@@ -243,7 +243,7 @@ class Localizer(LanguageManager, Folder):
assert
not
args
if
lang
is
not
None
:
kw
[
'target_language'
]
=
lang
return
translate
(
msgid
,
domain
=
domain
,
**
kw
)
return
translate
(
to_unicode
(
msgid
)
,
domain
=
domain
,
**
kw
)
InitializeClass
(
Localizer
)
...
...
product/Localizer/MessageCatalog.py
View file @
088be37b
...
...
@@ -76,7 +76,7 @@ def to_str(x):
"""Make sure we have an (utf-8 encoded) string"""
if
isinstance
(
x
,
str
):
return
x
x
.
encode
(
'utf-8'
)
return
x
.
encode
(
'utf-8'
)
def
message_encode
(
message
):
"""Encodes a message to an ASCII string.
...
...
@@ -230,12 +230,17 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
security
.
declarePublic
(
'message_exists'
)
def
message_exists
(
self
,
message
):
""" """
return
self
.
_messages
.
has_key
(
message
)
# BBB call get_message_key to support both (old) str key and
# (new) unicode key.
return
bool
(
self
.
get_message_key
(
message
))
security
.
declareProtected
(
'Manage messages'
,
'message_edit'
)
def
message_edit
(
self
,
message
,
language
,
translation
,
note
):
""" """
# BBB call get_message_key to support both (old) str key and
# (new) unicode key.
message
=
self
.
get_message_key
(
message
)
or
message
self
.
_messages
[
message
][
language
]
=
translation
self
.
_messages
[
message
][
'note'
]
=
note
...
...
@@ -243,6 +248,9 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
security
.
declareProtected
(
'Manage messages'
,
'message_del'
)
def
message_del
(
self
,
message
):
""" """
# BBB call get_message_key to support both (old) str key and
# (new) unicode key.
message
=
self
.
get_message_key
(
message
)
or
message
del
self
.
_messages
[
message
]
...
...
@@ -262,6 +270,10 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
if
default
is
None
:
default
=
message
# BBB call get_message_key to support both (old) str key and
# (new) unicode key.
message
=
self
.
get_message_key
(
message
)
or
to_unicode
(
message
)
# Add it if it's not in the dictionary
if
add
and
not
self
.
_messages
.
has_key
(
message
)
and
message
:
self
.
_messages
[
message
]
=
PersistentMapping
()
...
...
@@ -606,7 +618,7 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
RESPONSE
.
setHeader
(
'Content-Disposition'
,
'inline;filename=%s'
%
filename
)
return
'
\
n
'
.
join
(
r
2
)
return
'
\
n
'
.
join
(
r
)
security
.
declareProtected
(
'Manage messages'
,
'po_import'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment