From b88b4854876a46d7c39672a66a10009781108098 Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Sat, 3 Dec 2016 05:54:22 -0600 Subject: [PATCH] update POT file and add meson config for handling translations --- NEWS | 2 +- build/utils.sh | 37 ++++++++++++++++++------------ meson.build | 2 +- po/POTFILES | 2 ++ po/POTFILES.in | 5 ---- po/lightdm-webkit2-greeter.pot | 42 ++++++++++++---------------------- po/meson.build | 31 +++++++++++++++++++++++++ src/webkit2-extension.c | 6 ++--- 8 files changed, 76 insertions(+), 51 deletions(-) create mode 100644 po/POTFILES delete mode 100644 po/POTFILES.in create mode 100644 po/meson.build diff --git a/NEWS b/NEWS index a5fdaeb..f25cdf9 100644 --- a/NEWS +++ b/NEWS @@ -11,7 +11,7 @@ Overview of changes in lightdm-webkit2-greeter 2.2 * Updated API usage for LightDM 1.19.2+. * Updated bundled JS & CSS vendor libs to their latest versions. * Added two new options to the greeter config file which make it possible to override the - language and time format used by the greeter. + language and format used by the greeter when displaying the current time. * Added new theme utility method for getting the current localized time. * Updated translations with latest changes contributed by the Antergos Community on Transifex. * antergos theme (default): diff --git a/build/utils.sh b/build/utils.sh index b8e2e2e..85472e1 100755 --- a/build/utils.sh +++ b/build/utils.sh @@ -3,20 +3,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -do_build() { - (cd "$(dirname "${DIR}")" \ - && meson build \ - && cd build \ - && ninja) -} - -do_quick_install() { - (cd "$(dirname "${DIR}")/build/src" \ - && sudo cp lightdm-webkit2-greeter /usr/bin \ - && sudo cp liblightdm-webkit2-greeter-webext.so /usr/lib/lightdm-webkit2-greeter \ - && sudo cp -R ../../themes/antergos /usr/share/lightdm-webkit/themes) -} - clean_build_dir() { (cd "${DIR}" \ && find . -type f ! -path './ci*' ! -name '.gitignore' ! -name utils.sh -delete \ @@ -35,6 +21,25 @@ combine_javascript_sources() { } } +do_build() { + (cd "$(dirname "${DIR}")" \ + && meson build \ + && cd build \ + && ninja) +} + +do_quick_install() { + (cd "${DIR}/src" \ + && sudo cp lightdm-webkit2-greeter /usr/bin \ + && sudo cp liblightdm-webkit2-greeter-webext.so /usr/lib/lightdm-webkit2-greeter \ + && sudo cp -R ../../themes/antergos /usr/share/lightdm-webkit/themes) +} + +generate_pot_file() { + REPO_ROOT="$(dirname "${DIR}")" + xgettext --from-code UTF-8 -o "${REPO_ROOT}/po/lightdm-webkit2-greeter.pot" -d lightdm-webkit2-greeter "${REPO_ROOT}"/src/*.c +} + list_javascript_sources() { cd "${MESON_SOURCE_ROOT}/src" && find gresource/js -type f -name '*.js' -print } @@ -60,4 +65,8 @@ case "$1" in build-dev) clean_build_dir && do_build && do_quick_install ;; + + gen-pot) + generate_pot_file + ;; esac diff --git a/meson.build b/meson.build index 07f1fb4..8495f39 100644 --- a/meson.build +++ b/meson.build @@ -75,7 +75,7 @@ endif # ------->>> Sub Directories <<<------- # # ===================================== # -subdirs = ['src', 'man', 'themes', 'data'] +subdirs = ['src', 'man', 'themes', 'data', 'po'] foreach s : subdirs subdir(s) diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..5208342 --- /dev/null +++ b/po/POTFILES @@ -0,0 +1,2 @@ +src/greeter.c +src/webkit2-extension.c diff --git a/po/POTFILES.in b/po/POTFILES.in deleted file mode 100644 index 47a9130..0000000 --- a/po/POTFILES.in +++ /dev/null @@ -1,5 +0,0 @@ -# List of source files containing translatable strings. -# Please keep this file sorted alphabetically. -[encoding: UTF-8] -src/lightdm-webkit2-greeter.c -src/lightdm-webkit2-greeter-ext.c diff --git a/po/lightdm-webkit2-greeter.pot b/po/lightdm-webkit2-greeter.pot index c223c68..8feec74 100644 --- a/po/lightdm-webkit2-greeter.pot +++ b/po/lightdm-webkit2-greeter.pot @@ -1,14 +1,14 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# This file is distributed under the same license as the lightdm-webkit2-greeter package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: lightdm-webkit2-greeter\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-01-24 11:48-0600\n" +"POT-Creation-Date: 2016-12-03 05:51-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,36 +17,24 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/lightdm-webkit2-greeter-ext.c:132 -msgid "Expected a string" +#: src/greeter.c:135 +msgid "Greeter Theme Error Detected" msgstr "" -#: ../src/lightdm-webkit2-greeter-ext.c:654 -msgid "Hint argument not supplied" +#: src/greeter.c:138 +msgid "Load _Default Theme" msgstr "" -#: ../src/lightdm-webkit2-greeter-ext.c:681 -msgid "Response not supplied" +#: src/greeter.c:140 +msgid "Load _Fallback Theme" msgstr "" -#: ../src/lightdm-webkit2-greeter-ext.c:911 -msgid "Incorrect parameters" +#: src/greeter.c:142 +msgid "_Cancel" msgstr "" -#: ../src/lightdm-webkit2-greeter-ext.c:938 -msgid "Language not supplied" -msgstr "" - -#: ../src/lightdm-webkit2-greeter-ext.c:967 -msgid "Argument not supplied" -msgstr "" - -#: ../src/lightdm-webkit2-greeter-ext.c:996 -msgid "Needs 3 arguments" -msgstr "" - -#: ../src/lightdm-webkit2-greeter-ext.c:1038 -#: ../src/lightdm-webkit2-greeter-ext.c:1085 -#: ../src/lightdm-webkit2-greeter-ext.c:1128 -msgid "Needs 2 arguments" +#: src/greeter.c:151 +msgid "" +"An error was detected in the current theme that could interfere with the " +"system login process." msgstr "" diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..230e2cf --- /dev/null +++ b/po/meson.build @@ -0,0 +1,31 @@ +i18n = import('i18n') +langs = ['en'] + +i18n.gettext( + meson.project_name(), + languages : langs, + args: [ + '--default-domain=' + meson.project_name(), + '--from-code=UTF-8', + '--add-comments', + + '--keyword=_', + '--keyword=N_', + '--keyword=C_:1c,2', + '--keyword=NC_:1c,2', + '--keyword=g_dcgettext:2', + '--keyword=g_dngettext:2,3', + '--keyword=g_dpgettext2:2c,3', + + '--flag=N_:1:pass-c-format', + '--flag=C_:2:pass-c-format', + '--flag=NC_:2:pass-c-format', + '--flag=g_dngettext:2:pass-c-format', + '--flag=g_strdup_printf:1:c-format', + '--flag=g_string_printf:2:c-format', + '--flag=g_string_append_printf:2:c-format', + '--flag=g_error_new:3:c-format', + '--flag=g_set_error:4:c-format', + ]) + + diff --git a/src/webkit2-extension.c b/src/webkit2-extension.c index e5a8619..d3a65c0 100644 --- a/src/webkit2-extension.c +++ b/src/webkit2-extension.c @@ -68,10 +68,10 @@ /* - * Translatable strings + * Error messages */ -#define EXPECTSTRING _("Expected a string") -#define ARGNOTSUPPLIED _("Argument(s) not supplied") +#define EXPECTSTRING "Expected a string" +#define ARGNOTSUPPLIED "Argument(s) not supplied" G_MODULE_EXPORT void webkit_web_extension_initialize(WebKitWebExtension *extension);