Move data translations to content repository

pull/57/head
Hleb Valoshka 2021-12-01 21:56:17 +02:00
parent d1d8bea75f
commit a224da20d4
39 changed files with 130332 additions and 16 deletions

13
.gitignore vendored
View File

@ -1,21 +1,10 @@
*.user
Debug/
Release/
.vs/
*~
.deps
*.o
*.a
*.la
po*/*.gmo
po*/POTFILES
po*/stamp-po
.dirstamp
build
build-cmake
cmake-build
.qmake.stash
src/celestia/win32/res/resource_strings.cpp
src/celestia/qt/rc.cpp
data/*.cpp
*.cpp
.DS_Store

View File

@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.1.0)
project(celestia VERSION "1.7.0" LANGUAGES NONE)
option(NATIVE_OSX_APP "Support native OSX paths read data from (Default: off)" OFF)
option(ENABLE_NLS "Enable object names translation? (Default: on)" ON)
# Use our cmake files
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -10,6 +11,14 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(GNUInstallDirs)
include(install_to_extras_subdir)
if(ENABLE_NLS)
find_package(Gettext)
if(NOT GETTEXT_FOUND)
message(WARNING "Gettext is not found, traslations won't be created.")
endif()
include(FixGettext)
endif()
if(NATIVE_OSX_APP)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.app/Contents")
set(CMAKE_INSTALL_FULL_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/Resources/locale")
@ -25,5 +34,6 @@ add_subdirectory(data)
add_subdirectory(extras)
add_subdirectory(extras-standard)
add_subdirectory(models)
add_subdirectory(po)
add_subdirectory(textures)
add_subdirectory(warp)

View File

@ -0,0 +1,49 @@
macro(GETTEXT_CREATE_TRANSLATIONS2 _potFile _firstPoFileArg)
# make it a real variable, so we can modify it here
set(_firstPoFile "${_firstPoFileArg}")
set(_gmoFiles)
get_filename_component(_potName ${_potFile} NAME)
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
set(_addToAll)
if(${_firstPoFile} STREQUAL "ALL")
set(_addToAll "ALL")
set(_firstPoFile)
endif()
foreach (_currentPoFile ${_firstPoFile} ${ARGN})
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
get_filename_component(_abs_PATH ${_absFile} PATH)
get_filename_component(_lang ${_absFile} NAME_WE)
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
set(_poFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po)
add_custom_command(
OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --output-file=${_poFile} --lang=${_lang} --sort-output ${_absFile} ${_absPotFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
DEPENDS ${_absPotFile} ${_absFile}
)
if(NATIVE_OSX_APP)
install(FILES ${_gmoFile} DESTINATION Resources/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
else()
install(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
endif()
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
endforeach ()
if(NOT TARGET translations)
add_custom_target(translations)
endif()
_GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
add_dependencies(translations ${uniqueTargetName})
endmacro()

View File

@ -1,3 +1,6 @@
Milky Way
LMC
SMC
Pleiades
Hyades
Praesepe
@ -16,4 +19,4 @@ Fath 703
47 Tuc
Eridanus
Pyxis
Tonantzintla 2
Tonantzintla 2

View File

@ -1,4 +1,6 @@
Sol
Solar System Barycenter
Sun
Alpheratz
Sirrah
Caph
@ -503,4 +505,4 @@ Alkarab
Veritate
Poerava
Errai
Axólotl
Axólotl

View File

@ -3,3 +3,4 @@ usr/share/celestia/extras-standard
usr/share/celestia/data
usr/share/celestia/models
usr/share/celestia/textures
usr/share/locale

5
debian/changelog vendored
View File

@ -1,8 +1,9 @@
celestiacontent (1.7.0~git20200306+59e133f+0) UNRELEASED; urgency=medium
celestiacontent (1.7.0~git20211202+668347e9+0) bionic; urgency=medium
* New snapshot build
* Install translations for celestia-data.
-- Hleb Valoshka <375gnu@gmail.com> Fri, 06 Mar 2020 18:47:48 +0300
-- Hleb Valoshka <375gnu@gmail.com> Thu, 02 Dec 2021 11:09:22 +0200
celestia (1.6.1+dfsg-3.1) unstable; urgency=low

View File

@ -0,0 +1,6 @@
if((NOT ENABLE_NLS) OR (NOT GETTEXT_FOUND))
return()
endif()
file(GLOB PO_FILES "*.po")
gettext_create_translations2("celestia-data.pot" ALL ${PO_FILES})

37
po/Makefile 100644
View File

@ -0,0 +1,37 @@
po_files := $(wildcard *.po)
domain := celestia-data
pot_file := $(domain).pot
all: po-update
$(pot_file): $(pot_file)-update
$(pot_file)-update: data.cpp
xgettext --keyword=_ --keyword=i18n \
--sort-by-file --qt --add-comments \
--default-domain=$(domain) --package-name=celestia --package-version=1.7.0 \
--msgid-bugs-address=team@celestia.space \
--copyright-holder="Celestia Development Team" \
--output=$(pot_file) \
--from-code=utf-8 \
data.cpp
data.cpp: ../data/asterisms.dat ../data/solarsys.ssc ../data/earth_locs.ssc ../data/world-capitals.ssc ../data/dwarfplanets.ssc ../data/minormoons.ssc ../data/well-known-starnames.txt ../data/well-known-dsonames.txt
egrep '^\"' ../data/asterisms.dat | awk -F'\"' '{ print "_(\"" $$2 "\");" }' > data.cpp
egrep '^(\"|ReferencePoint)' ../data/solarsys.ssc | awk -F'\"|:' '{ print "_(\"" $$2 "\");" }' >> data.cpp
egrep '^(\"|ReferencePoint)' ../data/dwarfplanets.ssc | awk -F'\"|:' '{ print "_(\"" $$2 "\");" }' >> data.cpp
egrep '^(\"|ReferencePoint)' ../data/minormoons.ssc | awk -F'\"|:' '{ print "_(\"" $$2 "\");" }' >> data.cpp
grep \"Sol/Earth\" ../data/earth_locs.ssc | awk -F\" '{ print "_(\"" $$2 "\");" }' >> data.cpp
grep \"Sol/Earth\" ../data/world-capitals.ssc | awk -F\" '{ print "_(\"" $$2 "\");" }' >> data.cpp
cat ../data/well-known-starnames.txt | awk '{ print "_(\"" $$0 "\");" }' >> data.cpp
cat ../data/well-known-dsonames.txt | awk '{ print "_(\"" $$0 "\");" }' >> data.cpp
po-update: $(po_files)
%.po: $(pot_file)
msgmerge --update $@ $(pot_file)
clean: clean-data
clean-data:
rm -rf data.cpp

4494
po/ar.po 100644

File diff suppressed because it is too large Load Diff

4494
po/be.po 100644

File diff suppressed because it is too large Load Diff

4449
po/bg.po 100644

File diff suppressed because it is too large Load Diff

4402
po/celestia-data.pot 100644

File diff suppressed because it is too large Load Diff

4498
po/de.po 100644

File diff suppressed because it is too large Load Diff

4501
po/el.po 100644

File diff suppressed because it is too large Load Diff

4443
po/en.po 100644

File diff suppressed because it is too large Load Diff

4497
po/es.po 100644

File diff suppressed because it is too large Load Diff

4500
po/fr.po 100644

File diff suppressed because it is too large Load Diff

4500
po/gl.po 100644

File diff suppressed because it is too large Load Diff

4494
po/hu.po 100644

File diff suppressed because it is too large Load Diff

4501
po/it.po 100644

File diff suppressed because it is too large Load Diff

4500
po/ja.po 100644

File diff suppressed because it is too large Load Diff

4501
po/ko.po 100644

File diff suppressed because it is too large Load Diff

4501
po/lt.po 100644

File diff suppressed because it is too large Load Diff

4507
po/lv.po 100644

File diff suppressed because it is too large Load Diff

4496
po/nl.po 100644

File diff suppressed because it is too large Load Diff

4466
po/no.po 100644

File diff suppressed because it is too large Load Diff

4496
po/pl.po 100644

File diff suppressed because it is too large Load Diff

4494
po/pt.po 100644

File diff suppressed because it is too large Load Diff

4494
po/pt_BR.po 100644

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
# Sed script that remove the POT-Creation-Date line in the header entry
# from a POT file.
#
# The distinction between the first and the following occurrences of the
# pattern is achieved by looking at the hold space.
/^"POT-Creation-Date: .*"$/{
x
# Test if the hold space is empty.
s/P/P/
ta
# Yes it was empty. First occurrence. Remove the line.
g
d
bb
:a
# The hold space was nonempty. Following occurrences. Do nothing.
x
:b
}

4490
po/ro.po 100644

File diff suppressed because it is too large Load Diff

4498
po/ru.po 100644

File diff suppressed because it is too large Load Diff

4496
po/sk.po 100644

File diff suppressed because it is too large Load Diff

4496
po/sv.po 100644

File diff suppressed because it is too large Load Diff

4493
po/tr.po 100644

File diff suppressed because it is too large Load Diff

4504
po/uk.po 100644

File diff suppressed because it is too large Load Diff

4498
po/zh_CN.po 100644

File diff suppressed because it is too large Load Diff

4496
po/zh_TW.po 100644

File diff suppressed because it is too large Load Diff