ship pre-compiled locale files

This commit is contained in:
tildearrow 2024-05-31 19:55:56 -05:00
parent 3fc5979879
commit a68f572c23
22 changed files with 22 additions and 16 deletions

View file

@ -1176,17 +1176,6 @@ else()
add_executable(furnace ${USED_SOURCES})
endif()
if (WITH_LOCALE)
set(FURNACE_LANGUAGES de es fr fi hy ko nl pl pt_BR ru sk sv th tr uk)
set(FURNACE_LANGUAGE_DEPENDS "")
foreach(I IN LISTS FURNACE_LANGUAGES)
add_custom_command(OUTPUT "locale/${I}/LC_MESSAGES/furnace.mo" COMMAND mkdir -p "${CMAKE_BINARY_DIR}/locale/${I}/LC_MESSAGES/" COMMAND msgfmt ${CMAKE_SOURCE_DIR}/po/${I}.po -o "${CMAKE_BINARY_DIR}/locale/${I}/LC_MESSAGES/furnace.mo" DEPENDS po/${I}.po WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
list(APPEND FURNACE_LANGUAGE_DEPENDS "locale/${I}/LC_MESSAGES/furnace.mo")
endforeach()
add_custom_target(furnace-locale ALL DEPENDS ${FURNACE_LANGUAGE_DEPENDS})
endif()
target_include_directories(furnace SYSTEM PRIVATE ${DEPENDENCIES_INCLUDE_DIRS})
target_compile_options(furnace PRIVATE ${DEPENDENCIES_COMPILE_OPTIONS})
target_link_libraries(furnace PRIVATE ${DEPENDENCIES_LIBRARIES})

View file

@ -19,7 +19,7 @@ android {
versionName "0.6.3"
externalNativeBuild {
cmake {
arguments "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DWARNINGS_ARE_ERRORS=ON"
arguments "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DWARNINGS_ARE_ERRORS=ON", "-DWITH_LOCALE=ON", "-DUSE_MOMO=ON"
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
abiFilters 'arm64-v8a'
}

View file

@ -0,0 +1 @@
../../../../../po/locale

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
scripts/build-po.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
EXPORT_LANGS=("de" "es" "fr" "fi" "hy" "ko" "nl" "pl" "pt_BR" "ru" "sk" "sv" "th" "tr" "uk")
for i in ${EXPORT_LANGS[@]}; do
echo "compiling $i.po..."
mkdir -p "po/locale/$i/LC_MESSAGES/" && msgfmt "po/$i.po" -o "po/locale/$i/LC_MESSAGES/furnace.mo"
done

View file

@ -58,6 +58,13 @@ struct sigaction termsa;
#define TA_TEXTDOMAIN textdomain
#endif
#ifndef LC_CTYPE
#define LC_CTYPE 0
#endif
#ifndef LC_MESSAGES
#define LC_MESSAGES 1
#endif
#include "cli/cli.h"
#ifdef HAVE_GUI
@ -501,12 +508,12 @@ int main(int argc, char** argv) {
#ifdef HAVE_LOCALE
const char* localeRet=NULL;
if ((localeRet=TA_SETLOCALE(LC_CTYPE,""))==NULL) {
if ((localeRet=TA_SETLOCALE(LC_CTYPE,"pt_BR"))==NULL) {
logE("could not set locale (CTYPE)!");
} else {
logV("locale: %s",localeRet);
}
if ((localeRet=TA_SETLOCALE(LC_MESSAGES,""))==NULL) {
if ((localeRet=TA_SETLOCALE(LC_MESSAGES,"pt_BR"))==NULL) {
logE("could not set locale (MESSAGES)!");
} else {
logV("locale: %s",localeRet);

View file

@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "libintl.h"
#include "momo.h"
static char curLocale[64];
static char tempPath[4096];

View file

@ -24,11 +24,13 @@
extern "C" {
#endif
#define MOMO_FORMATARG __attribute__((format_arg(1)))
const char* momo_setlocale(int type, const char* locale);
const char* momo_bindtextdomain(const char* domainName, const char* dirName);
const char* momo_textdomain(const char* domainName);
const char* momo_gettext(const char* str);
const char* momo_gettext(const char* str) MOMO_FORMATARG;
const char* momo_ngettext(const char* str1, const char* str2, unsigned long amount);
#ifdef __cplusplus