Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# Copyright (c) 2025-present The Bitcoin Core developers2# Distributed under the MIT software license, see the accompanying3# file COPYING or http://www.opensource.org/licenses/mit-license.php.5cmake_minimum_required(VERSION 3.22)7set(input_variables8PROJECT_SOURCE_DIR9COPYRIGHT_HOLDERS10LUPDATE_EXECUTABLE11XGETTEXT_EXECUTABLE12)14foreach(var IN LISTS input_variables)15if(NOT DEFINED ${var})16message(FATAL_ERROR "Variable '${var}' is not defined!")17endif()18endforeach()20# Extract _("...") strings for translation and convert to Qt stringdefs so that21# they can be picked up by Qt linguist.22function(extract_strings output)23execute_process(24COMMAND ${XGETTEXT_EXECUTABLE}25--output=bitcoinstrings.po26--no-location27--from-code=utf-828--keyword=_29${ARGN}30COMMAND_ERROR_IS_FATAL ANY31)33file(STRINGS "bitcoinstrings.po" text ENCODING "UTF-8")35set(messages "${COPYRIGHT_HOLDERS}")36foreach(line IN LISTS text)37if(line MATCHES "^msgid \"(.*)\"$")38set(msgid "${CMAKE_MATCH_1}")39elseif(line MATCHES "^\"(.*)\"$")40string(APPEND msgid "${CMAKE_MATCH_1}")41elseif(line MATCHES "^msgstr .*$" AND NOT msgid STREQUAL "")42# CMake uses ';' as a list separator.43# We need to temporarily replace that in order to keep strings intact.44string(REPLACE ";" "<cmake-semicolon>" msgid "${msgid}")45list(APPEND messages "${msgid}")46endif()47endforeach()49set(content [[// Automatically generated by translate.cmake51#include <QtGlobal>53#ifdef __GNUC__54#define UNUSED __attribute__((unused))55#else56#define UNUSED57#endif59static const char UNUSED *bitcoin_strings[] = {60]])62set(prefix "QT_TRANSLATE_NOOP(\"bitcoin-core\", \"")63set(suffix "\"),\n")65list(SORT messages)66list(JOIN messages "${suffix}${prefix}" messages_str)67string(APPEND content "${prefix}${messages_str}${suffix}")68string(APPEND content "};\n")69string(REPLACE "<cmake-semicolon>" ";" content "${content}")71file(WRITE "${output}" "${content}")72endfunction()74file(GLOB_RECURSE translatable_sources75"${PROJECT_SOURCE_DIR}/src/*.h"76"${PROJECT_SOURCE_DIR}/src/*.cpp"77"${PROJECT_SOURCE_DIR}/src/*.mm"78)80file(GLOB_RECURSE qt_translatable_sources81"${PROJECT_SOURCE_DIR}/src/qt/*.h"82"${PROJECT_SOURCE_DIR}/src/qt/*.cpp"83"${PROJECT_SOURCE_DIR}/src/qt/*.mm"84)86file(GLOB ui_files87"${PROJECT_SOURCE_DIR}/src/qt/forms/*.ui"88)90set(subtrees crc32c crypto/ctaes leveldb minisketch secp256k1)91set(exclude_dirs bench compat crypto support test univalue)92foreach(directory IN LISTS subtrees exclude_dirs)93list(FILTER translatable_sources94EXCLUDE REGEX "${PROJECT_SOURCE_DIR}/src/${directory}/.*"95)96endforeach()98extract_strings("${PROJECT_SOURCE_DIR}/src/qt/bitcoinstrings.cpp"99${translatable_sources}100)102execute_process(103COMMAND ${LUPDATE_EXECUTABLE}104-no-obsolete105-sort-messages106-I ${PROJECT_SOURCE_DIR}/src107-locations none108-target-language en109${ui_files}110${qt_translatable_sources}111${PROJECT_SOURCE_DIR}/src/qt/bitcoinstrings.cpp112-ts ${PROJECT_SOURCE_DIR}/src/qt/locale/bitcoin_en.ts113COMMAND_ERROR_IS_FATAL ANY114)
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.