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
Titouan Soulard
erp5
Commits
ede3a09e
Commit
ede3a09e
authored
Apr 18, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2to3: Upstream itools does not support python3.
parent
e2e2de5a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
13 deletions
+16
-13
product/Localizer/itools/i18n/__init__.py
product/Localizer/itools/i18n/__init__.py
+8
-7
product/Localizer/itools/i18n/accept.py
product/Localizer/itools/i18n/accept.py
+2
-2
product/Localizer/itools/i18n/locale_.py
product/Localizer/itools/i18n/locale_.py
+5
-3
product/Localizer/itools/utils.py
product/Localizer/itools/utils.py
+1
-1
No files found.
product/Localizer/itools/i18n/__init__.py
View file @
ede3a09e
...
...
@@ -17,13 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Import from itools
from
accept
import
AcceptLanguageType
,
get_accept
,
select_language
from
accept
import
init_language_selector
from
fuzzy
import
get_distance
,
get_similarity
,
is_similar
,
get_most_similar
from
languages
import
has_language
,
get_languages
,
get_language_name
from
locale_
import
format_date
,
format_time
,
format_datetime
from
locale_
import
format_number
from
oracle
import
guess_language
,
is_asian_character
,
is_punctuation
from
__future__
import
absolute_import
from
.accept
import
AcceptLanguageType
,
get_accept
,
select_language
from
.accept
import
init_language_selector
from
.fuzzy
import
get_distance
,
get_similarity
,
is_similar
,
get_most_similar
from
.languages
import
has_language
,
get_languages
,
get_language_name
from
.locale_
import
format_date
,
format_time
,
format_datetime
from
.locale_
import
format_number
from
.oracle
import
guess_language
,
is_asian_character
,
is_punctuation
...
...
product/Localizer/itools/i18n/accept.py
View file @
ede3a09e
...
...
@@ -20,7 +20,7 @@ protocol.
"""
# Import from the Standard Library
import
__builtin__
import
builtins
from
decimal
import
Decimal
from
locale
import
getdefaultlocale
...
...
@@ -160,7 +160,7 @@ def select_language(languages=None):
def
init_language_selector
(
language_selector
=
select_language
):
__builtin__
.
__dict__
[
'select_language'
]
=
language_selector
builtins
.
__dict__
[
'select_language'
]
=
language_selector
# Set default language selector
...
...
product/Localizer/itools/i18n/locale_.py
View file @
ede3a09e
...
...
@@ -18,12 +18,13 @@
"""
Output dates and times in locale format.
"""
from
__future__
import
absolute_import
# Import from the Standard Library
from
decimal
import
Decimal
# Import from itools
from
accept
import
get_accept
from
.
accept
import
get_accept
def
get_format
(
source
,
accept
):
...
...
@@ -32,7 +33,7 @@ def get_format(source, accept):
accept
=
get_accept
()
# Negotiate
available_languages
=
source
.
keys
(
)
available_languages
=
list
(
source
.
keys
()
)
language
=
accept
.
select_language
(
available_languages
)
if
language
is
None
:
language
=
'en'
...
...
@@ -97,7 +98,8 @@ def moneyfmt(value, places=2, curr=u'', sep=u',', dp=u'.', pos=u'',
q
=
Decimal
(
10
)
**
-
places
# 2 places --> '0.01'
sign
,
digits
,
exp
=
value
.
quantize
(
q
).
as_tuple
()
result
=
[]
digits
=
map
(
unicode
,
digits
)
import
six
digits
=
[
six
.
text_type
(
d
)
for
d
in
digits
]
build
,
next
=
result
.
append
,
digits
.
pop
if
curr
:
build
(
curr
)
...
...
product/Localizer/itools/utils.py
View file @
ede3a09e
...
...
@@ -99,6 +99,6 @@ def get_pipe(command, cwd=None):
popen
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
PIPE
,
cwd
=
cwd
)
stdoutdata
,
stderrdata
=
popen
.
communicate
()
if
popen
.
returncode
!=
0
:
raise
EnvironmentError
,
(
popen
.
returncode
,
stderrdata
)
raise
EnvironmentError
(
popen
.
returncode
,
stderrdata
)
return
stdoutdata
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