Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
7c1b1a71
Commit
7c1b1a71
authored
Feb 09, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Localizer: py3
parent
1beb7860
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
product/Localizer/MessageCatalog.py
product/Localizer/MessageCatalog.py
+6
-6
product/Localizer/__init__.py
product/Localizer/__init__.py
+1
-3
No files found.
product/Localizer/MessageCatalog.py
View file @
7c1b1a71
...
@@ -106,15 +106,11 @@ def message_decode(message):
...
@@ -106,15 +106,11 @@ def message_decode(message):
To be used in the user interface, to avoid problems with the
To be used in the user interface, to avoid problems with the
encodings, HTML entities, etc..
encodings, HTML entities, etc..
"""
"""
message
=
decodebytes
(
message
)
message
=
decodebytes
(
message
.
encode
()
)
encoding
=
HTTPRequest
.
default_encoding
encoding
=
HTTPRequest
.
default_encoding
return
six
.
text_type
(
message
,
encoding
)
return
six
.
text_type
(
message
,
encoding
)
def
filter_sort
(
x
,
y
):
return
cmp
(
to_unicode
(
x
),
to_unicode
(
y
))
def
get_url
(
url
,
batch_start
,
batch_size
,
regex
,
lang
,
empty
,
**
kw
):
def
get_url
(
url
,
batch_start
,
batch_size
,
regex
,
lang
,
empty
,
**
kw
):
params
=
[]
params
=
[]
for
key
,
value
in
six
.
iteritems
(
kw
):
for
key
,
value
in
six
.
iteritems
(
kw
):
...
@@ -396,7 +392,7 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
...
@@ -396,7 +392,7 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
for
m
,
t
in
six
.
iteritems
(
self
.
_messages
):
for
m
,
t
in
six
.
iteritems
(
self
.
_messages
):
if
query
.
search
(
m
)
and
(
not
empty
or
not
t
.
get
(
lang
,
''
).
strip
()):
if
query
.
search
(
m
)
and
(
not
empty
or
not
t
.
get
(
lang
,
''
).
strip
()):
messages
.
append
(
m
)
messages
.
append
(
m
)
messages
.
sort
(
filter_sort
)
messages
.
sort
(
key
=
lambda
m
:
to_unicode
(
m
)
)
# How many messages
# How many messages
n
=
len
(
messages
)
n
=
len
(
messages
)
namespace
[
'n_messages'
]
=
n
namespace
[
'n_messages'
]
=
n
...
@@ -664,6 +660,10 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
...
@@ -664,6 +660,10 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
messages
=
self
.
_messages
messages
=
self
.
_messages
# Load the data
# Load the data
if
isinstance
(
data
,
bytes
):
# six.PY2
pass
elif
isinstance
(
data
,
bytes
):
# six.PY3
data
=
data
.
decode
()
po
=
polib
.
pofile
(
data
)
po
=
polib
.
pofile
(
data
)
encoding
=
to_str
(
po
.
encoding
)
encoding
=
to_str
(
po
.
encoding
)
for
entry
in
po
:
for
entry
in
po
:
...
...
product/Localizer/__init__.py
View file @
7c1b1a71
...
@@ -23,9 +23,7 @@ from App.ImageFile import ImageFile
...
@@ -23,9 +23,7 @@ from App.ImageFile import ImageFile
from
DocumentTemplate.DT_String
import
String
from
DocumentTemplate.DT_String
import
String
# Import from Localizer
# Import from Localizer
import
six
from
.
import
patches
as
_
if
six
.
PY2
:
from
.
import
patches
as
_
from
.
import
Localizer
,
MessageCatalog
from
.
import
Localizer
,
MessageCatalog
from
.LocalFiles
import
LocalDTMLFile
from
.LocalFiles
import
LocalDTMLFile
...
...
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