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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
de9c3f42
Commit
de9c3f42
authored
Feb 09, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Localizer: py3
parent
8180df7b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
product/Localizer/MessageCatalog.py
product/Localizer/MessageCatalog.py
+4
-6
product/Localizer/__init__.py
product/Localizer/__init__.py
+1
-3
No files found.
product/Localizer/MessageCatalog.py
View file @
de9c3f42
...
...
@@ -106,15 +106,11 @@ def message_decode(message):
To be used in the user interface, to avoid problems with the
encodings, HTML entities, etc..
"""
message
=
decodebytes
(
message
)
message
=
decodebytes
(
message
.
encode
()
)
encoding
=
HTTPRequest
.
default_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
):
params
=
[]
for
key
,
value
in
six
.
iteritems
(
kw
):
...
...
@@ -396,7 +392,7 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
for
m
,
t
in
six
.
iteritems
(
self
.
_messages
):
if
query
.
search
(
m
)
and
(
not
empty
or
not
t
.
get
(
lang
,
''
).
strip
()):
messages
.
append
(
m
)
messages
.
sort
(
filter_sort
)
messages
.
sort
(
key
=
lambda
m
:
to_unicode
(
m
)
)
# How many messages
n
=
len
(
messages
)
namespace
[
'n_messages'
]
=
n
...
...
@@ -664,6 +660,8 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
messages
=
self
.
_messages
# Load the data
if
isinstance
(
data
,
bytes
):
data
=
data
.
decode
()
po
=
polib
.
pofile
(
data
)
encoding
=
to_str
(
po
.
encoding
)
for
entry
in
po
:
...
...
product/Localizer/__init__.py
View file @
de9c3f42
...
...
@@ -23,9 +23,7 @@ from App.ImageFile import ImageFile
from
DocumentTemplate.DT_String
import
String
# Import from Localizer
import
six
if
six
.
PY2
:
from
.
import
patches
as
_
from
.
import
patches
as
_
from
.
import
Localizer
,
MessageCatalog
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