Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions share/qt/extract_strings_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
they can be picked up by Qt linguist.
'''
from __future__ import division,print_function,unicode_literals
from subprocess import Popen, PIPE
from subprocess import run, PIPE
import operator
import os
import sys
Expand Down Expand Up @@ -59,8 +59,7 @@ def parse_po(text):
print('Cannot extract strings: xgettext utility is not installed or not configured.',file=sys.stderr)
print('Please install package "gettext" and re-run \'./configure\'.',file=sys.stderr)
exit(1)
child = Popen([XGETTEXT,'--output=-','-n','--keyword=_'] + files, stdout=PIPE)
(out, err) = child.communicate()
out = run([XGETTEXT,'--output=-','-n','--keyword=_'] + files, stdout=PIPE, check=True).stdout

messages = parse_po(out.decode('utf-8'))

Expand All @@ -77,13 +76,13 @@ def parse_po(text):
#endif
""")
f.write('static const char UNUSED *bitcoin_strings[] = {\n')
f.write('QT_TRANSLATE_NOOP("bitcoin-core", "%s"),\n' % (os.getenv('PACKAGE_NAME'),))
f.write('QT_TRANSLATE_NOOP("bitcoin-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS'),))
f.write('QT_TRANSLATE_NOOP("firo-core", "%s"),\n' % (os.getenv('PACKAGE_NAME'),))
f.write('QT_TRANSLATE_NOOP("firo-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS'),))
if os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION') != os.getenv('PACKAGE_NAME'):
f.write('QT_TRANSLATE_NOOP("bitcoin-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION'),))
f.write('QT_TRANSLATE_NOOP("firo-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION'),))
messages.sort(key=operator.itemgetter(0))
for (msgid, msgstr) in messages:
if msgid != EMPTY:
f.write('QT_TRANSLATE_NOOP("bitcoin-core", %s),\n' % ('\n'.join(msgid)))
f.write('QT_TRANSLATE_NOOP("firo-core", %s),\n' % ('\n'.join(msgid)))
f.write('};\n')
f.close()
6 changes: 5 additions & 1 deletion src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,12 @@ else()
get_translatable_sources(translatable_sources ${translatable_sources_directories})
get_translatable_sources(qt_translatable_sources src/qt)
file(GLOB ui_files ${CMAKE_CURRENT_SOURCE_DIR}/forms/*.ui)
list(REMOVE_DUPLICATES translatable_sources)
list(JOIN translatable_sources "\n" translatable_sources_content)
set(translatable_sources_file "${CMAKE_CURRENT_BINARY_DIR}/translation_sources.txt")
file(GENERATE OUTPUT "${translatable_sources_file}" CONTENT "${translatable_sources_content}\n")
add_custom_target(translate
COMMAND ${CMAKE_COMMAND} -E env XGETTEXT=${XGETTEXT_EXECUTABLE} COPYRIGHT_HOLDERS=${COPYRIGHT_HOLDERS} $<TARGET_FILE:Python3::Interpreter> ${PROJECT_SOURCE_DIR}/share/qt/extract_strings_qt.py ${translatable_sources}
COMMAND ${CMAKE_COMMAND} -E env XGETTEXT=${XGETTEXT_EXECUTABLE} "PACKAGE_NAME=${CLIENT_NAME}" "COPYRIGHT_HOLDERS=${COPYRIGHT_HOLDERS}" "COPYRIGHT_HOLDERS_SUBSTITUTION=${CLIENT_NAME}" $<TARGET_FILE:Python3::Interpreter> ${PROJECT_SOURCE_DIR}/share/qt/extract_strings_qt.py --files-from=${translatable_sources_file}
COMMAND Qt6::lupdate -no-obsolete -I ${PROJECT_SOURCE_DIR}/src -locations relative ${CMAKE_CURRENT_SOURCE_DIR}/bitcoinstrings.cpp ${ui_files} ${qt_translatable_sources} -ts ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.ts
COMMAND Qt6::lconvert -drop-translations -o ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.xlf -i ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.ts
COMMAND ${SED_EXECUTABLE} -i.old -e "s|source-language=\"en\" target-language=\"en\"|source-language=\"en\"|" -e "/<target xml:space=\"preserve\"><\\/target>/d" ${CMAKE_CURRENT_SOURCE_DIR}/locale/bitcoin_en.xlf
Expand Down
268 changes: 130 additions & 138 deletions src/qt/bitcoinstrings.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/qt/locale/bitcoin_bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@
</message>
<message>
<source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source>
<translation>Въведeте &lt;/b&gt;помощ&lt;/b&gt; за да видите наличните команди.</translation>
<translation>Напишете &lt;b&gt;help&lt;/b&gt;, за да прегледате възможните команди.</translation>
</message>
<message>
<source>%1 B</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/bitcoin_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1610,11 +1610,11 @@
</message>
<message>
<source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'historial, i &lt;b&gt;Ctrl-L&lt;\b&gt; per netejar la pantalla.</translation>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'historial, i &lt;b&gt;Ctrl-L&lt;/b&gt; per netejar la pantalla.</translation>
</message>
<message>
<source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source>
<translation>Escriviu &lt;b&gt;help&lt;\b&gt; per a obtenir un llistat de les ordres disponibles.</translation>
<translation>Escriviu &lt;b&gt;help&lt;/b&gt; per a obtenir un llistat de les ordres disponibles.</translation>
</message>
<message>
<source>%1 B</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/bitcoin_ca@valencia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1378,11 +1378,11 @@
</message>
<message>
<source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'historial, i &lt;b&gt;Ctrl-L&lt;\b&gt; per netejar la pantalla.</translation>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'historial, i &lt;b&gt;Ctrl-L&lt;/b&gt; per netejar la pantalla.</translation>
</message>
<message>
<source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source>
<translation>Escriviu &lt;b&gt;help&lt;\b&gt; per a obtindre un llistat de les ordes disponibles.</translation>
<translation>Escriviu &lt;b&gt;help&lt;/b&gt; per a obtindre un llistat de les ordes disponibles.</translation>
</message>
<message>
<source>%1 B</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/bitcoin_ca_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1610,11 +1610,11 @@
</message>
<message>
<source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'historial, i &lt;b&gt;Ctrl-L&lt;\b&gt; per netejar la pantalla.</translation>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'historial, i &lt;b&gt;Ctrl-L&lt;/b&gt; per netejar la pantalla.</translation>
</message>
<message>
<source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source>
<translation>Escriviu &lt;b&gt;help&lt;\b&gt; per a obtenir un llistat de les ordres disponibles.</translation>
<translation>Escriviu &lt;b&gt;help&lt;/b&gt; per a obtenir un llistat de les ordres disponibles.</translation>
</message>
<message>
<source>%1 B</source>
Expand Down
Loading