Skip to content

Commit

Permalink
Added translation support for strings within scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-w committed Jan 19, 2019
1 parent b36c8a5 commit e639997
Show file tree
Hide file tree
Showing 16 changed files with 1,566 additions and 124 deletions.
6 changes: 6 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ source_file = po/stellarium-planetary-features/stellarium-planetary-features.pot
source_lang = en
type = PO

[stellarium.stellarium-scripts]
file_filter = po/stellarium-scripts/<lang>.po
source_file = po/stellarium-scripts/stellarium-scripts.pot
source_lang = en
type = PO

[stellarium.stellarium-remotecontrol]
file_filter = po/stellarium-remotecontrol/<lang>.po
source_file = po/stellarium-remotecontrol/stellarium-remotecontrol.pot
Expand Down
3 changes: 3 additions & 0 deletions po/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
ADD_SUBDIRECTORY(stellarium)
ADD_SUBDIRECTORY(stellarium-skycultures)
ADD_SUBDIRECTORY(stellarium-planetary-features)
IF(ENABLE_SCRIPTING)
ADD_SUBDIRECTORY(stellarium-scripts)
ENDIF()
IF(USE_PLUGIN_REMOTECONTROL)
ADD_SUBDIRECTORY(stellarium-remotecontrol)
ENDIF()
28 changes: 28 additions & 0 deletions po/stellarium-scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FILE(GLOB poscfiles RELATIVE "${CMAKE_SOURCE_DIR}/po/stellarium-scripts/" "*.po")
LIST(SORT poscfiles)
STRING(REGEX REPLACE ".po" "" outposcfiles "${poscfiles}")

GETTEXT_CREATE_TRANSLATIONS(stellarium-scripts DEFAULT_TARGET ${outposcfiles})

# Discard this target if xgettext is not installed
IF(${XGETTEXT_FOUND})
ADD_CUSTOM_TARGET(
generate-pot-stellarium-scripts
${GETTEXT_XGETTEXT_EXECUTABLE}
-o stellarium-scripts.pot
--keyword=tr
--language=JavaScript
--add-comments=TRANSLATORS:
--directory=${PROJECT_SOURCE_DIR}
--files-from=POTFILES.in
--copyright-holder=Stellarium's\ team
[email protected]
--from-code=utf-8
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating stellarium-scripts.pot"
VERBATIM
)

# Generate this POT file when building the "generate-pot" target.
ADD_DEPENDENCIES(generate-pot generate-pot-stellarium-scripts)
ENDIF()
6 changes: 6 additions & 0 deletions po/stellarium-scripts/POTFILES.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Translatable scripts
scripts/bennett.ssc
scripts/best_ngc.ssc
scripts/binocular_highlights.ssc
scripts/binosky.ssc
scripts/double_stars.ssc
Loading

0 comments on commit e639997

Please sign in to comment.