Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
d676999f
Commit
d676999f
authored
5 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[fix] fix Qt standardButtons translation
run gen_translations.py after this commit
parent
207513ba
No related branches found
No related tags found
1 merge request
!775
0.50.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gen_translations.py
+5
-0
5 additions, 0 deletions
gen_translations.py
src/sakia/app.py
+20
-6
20 additions, 6 deletions
src/sakia/app.py
with
25 additions
and
6 deletions
gen_translations.py
+
5
−
0
View file @
d676999f
...
...
@@ -64,4 +64,9 @@ def build_resources():
prepare_qm
()
# add Qt standardButtons qm file
# This file must be copied from Qt libs in the res/i18n/qm folder of the project
qtbase_filename
=
"
qtbase_fr.qm
"
if
os
.
path
.
exists
(
os
.
path
.
join
(
qm
,
qtbase_filename
)):
qm_shortnames
.
append
(
qtbase_filename
)
build_resources
()
This diff is collapsed.
Click to expand it.
src/sakia/app.py
+
20
−
6
View file @
d676999f
...
...
@@ -5,7 +5,7 @@ import socket
import
sakia.i18n_rc
import
async_timeout
import
aiohttp
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
,
QTranslator
,
QCoreApplication
,
QLocale
,
Qt
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
,
QTranslator
,
QCoreApplication
,
QLocale
,
Qt
,
QFile
from
.
import
__version__
from
.options
import
SakiaOptions
from
sakia.data.connectors
import
BmaConnector
...
...
@@ -89,6 +89,7 @@ class Application(QObject):
_logger
=
attr
.
ib
(
default
=
attr
.
Factory
(
lambda
:
logging
.
getLogger
(
"
sakia
"
)))
available_version
=
attr
.
ib
(
init
=
False
)
_translator
=
attr
.
ib
(
init
=
False
)
_qt_translator
=
attr
.
ib
(
init
=
False
)
def
__attrs_post_init__
(
self
):
super
().
__init__
()
...
...
@@ -224,13 +225,26 @@ class Application(QObject):
self
.
_translator
=
QTranslator
(
self
.
qapp
)
if
locale
==
"
en
"
:
QCoreApplication
.
installTranslator
(
self
.
_translator
)
elif
self
.
_translator
.
load
(
"
:/i18n/{0}
"
.
format
(
locale
)):
else
:
# load chosen language
filepath
=
"
:/i18n/{0}
"
.
format
(
locale
)
if
not
QFile
.
exists
(
filepath
):
self
.
_logger
.
debug
(
"
File not found: {0}
"
.
format
(
filepath
))
self
.
_translator
.
load
(
filepath
)
if
QCoreApplication
.
installTranslator
(
self
.
_translator
):
self
.
_logger
.
debug
(
"
Loaded
i18n/
{0}
"
.
format
(
locale
))
self
.
_logger
.
debug
(
"
Loaded {0}
"
.
format
(
filepath
))
else
:
self
.
_logger
.
debug
(
"
Couldn
'
t load translation
"
)
else
:
self
.
_logger
.
debug
(
"
Couldn
'
t load i18n/{0}
"
.
format
(
locale
))
self
.
_logger
.
debug
(
"
Couldn
'
t load {0}
"
.
format
(
filepath
))
# load standardButtons Qt translation
filepath
=
"
:/i18n/qtbase_{0}
"
.
format
(
locale
)
if
not
QFile
.
exists
(
filepath
):
self
.
_logger
.
debug
(
"
File not found: {0}
"
.
format
(
filepath
))
self
.
_qt_translator
=
QTranslator
(
self
.
qapp
)
self
.
_qt_translator
.
load
(
filepath
)
if
QCoreApplication
.
installTranslator
(
self
.
_qt_translator
):
self
.
_logger
.
debug
(
"
Loaded {0}
"
.
format
(
filepath
))
else
:
self
.
_logger
.
debug
(
"
Couldn
'
t load {0}
"
.
format
(
filepath
))
def
start_coroutines
(
self
):
self
.
network_service
.
start_coroutines
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment