Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Kajongg
Commits
2a30b4d5
Commit
2a30b4d5
authored
Dec 15, 2017
by
Wolfgang Rohdewald
Browse files
KDETranslator: if kajongg wants no translation, override the qt5 default translator
parent
b9c92b44
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/kdestub.py
View file @
2a30b4d5
...
...
@@ -98,6 +98,9 @@ class KApplication(QApplication):
for
_
in
self
.
translators
:
self
.
removeTranslator
(
_
)
self
.
translators
=
[]
_
=
KDETranslator
(
self
)
self
.
translators
.
append
(
_
)
self
.
installTranslator
(
_
)
for
language
in
reversed
(
list
(
MLocale
.
extendRegionLanguages
(
MLocale
.
currentLanguages
()))):
self
.
installTranslatorFile
(
os
.
path
.
join
(
QLibraryInfo
.
location
(
QLibraryInfo
.
TranslationsPath
),
'qtbase_{}.qm'
.
format
(
language
)))
...
...
src/mi18n.py
View file @
2a30b4d5
...
...
@@ -160,12 +160,16 @@ class KDETranslator(QTranslator):
if
Debug
.
neutral
:
return
text
result
=
QTranslator
.
translate
(
self
,
context
,
text
,
disambiguation
,
numerus
)
if
not
result
:
# for kwidgetsaddons5_qt locale de, KStandardGuiItem '&OK' returns an empty string.
# but this works for other languages like uk, catalan, ptbr and zh_TW.
# What is different with German? The .po source seems OK, just like the others.
result
=
i18n
(
text
)
return
result
if
result
:
return
result
if
not
MLocale
.
currentLanguages
():
# when starting kajongg.py, qt5 loads translators for the system default
# language. I do not know how to avoid that. And I cannot delete
# translators I do not own. So if we want no translation, just return text.
# But we still need to install our own QTranslator overriding the ones
# mentioned above. It will never find a translation, so we come here.
assert
Internal
.
app
.
translators
==
[
self
]
return
text
class
MLocale
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment