Merge lp:~lukas-kde/ubuntu-settings-components/extractPo into lp:~registry/ubuntu-settings-components/trunk

Proposed by Lukáš Tinkl on 2015-08-02
Status: Merged
Approved by: Albert Astals Cid on 2015-08-04
Approved revision: 96
Merged at revision: 94
Proposed branch: lp:~lukas-kde/ubuntu-settings-components/extractPo
Merge into: lp:~registry/ubuntu-settings-components/trunk
Diff against target: 180 lines (+110/-5)
7 files modified
CMakeLists.txt (+1/-0)
plugins/Ubuntu/Settings/Components/QuickReply.qml (+1/-1)
plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml (+3/-3)
plugins/Ubuntu/Settings/Menus/TextMessageMenu.qml (+1/-1)
po/CMakeLists.txt (+33/-0)
po/ubuntu-settings-components.pot (+35/-0)
po/update-usc-pot (+36/-0)
To merge this branch: bzr merge lp:~lukas-kde/ubuntu-settings-components/extractPo
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) 2015-08-02 Approve on 2015-08-04
PS Jenkins bot (community) continuous-integration Approve on 2015-08-04
Registry Administrators 2015-08-02 Pending
Review via email: mp+266669@code.launchpad.net

Commit Message

Setup message extraction, load the catalog from the plugins

Description of the Change

Setup message extraction, load the catalog from the plugins

Until now, the user visible strings haven't been extracted and therefore couldn't be translated.

To post a comment you must log in.
Albert Astals Cid (aacid) wrote :

I don't think we should include the Czech translation, should be done via https://translations.launchpad.net/ubuntu-settings-components once we commit this and configure that page correctly

review: Needs Fixing
Lukáš Tinkl (lukas-kde) wrote :

> I don't think we should include the Czech translation, should be done via
> https://translations.launchpad.net/ubuntu-settings-components once we commit
> this and configure that page correctly

Fair enough, yup. I'll adjust it

95. By Lukáš Tinkl on 2015-08-04

don't ship cs.po, rely on launchpad for the translations

Albert Astals Cid (aacid) wrote :

Thinkign about this, i think this is not the correct solution, calling textdomain will overwrite the text domain set by the application that uses this plugin making its i18n() untranslated.

We should just use i18n.dtr() instead of i18n.tr()

review: Needs Fixing
96. By Lukáš Tinkl on 2015-08-04

use i18n.dtr() instead of overwriting the textdomain

Albert Astals Cid (aacid) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-04-07 09:42:19 +0000
3+++ CMakeLists.txt 2015-08-04 14:58:07 +0000
4@@ -98,3 +98,4 @@
5 add_subdirectory(plugins)
6 add_subdirectory(examples)
7 add_subdirectory(tests)
8+add_subdirectory(po)
9
10=== modified file 'plugins/Ubuntu/Settings/Components/QuickReply.qml'
11--- plugins/Ubuntu/Settings/Components/QuickReply.qml 2014-09-25 11:35:37 +0000
12+++ plugins/Ubuntu/Settings/Components/QuickReply.qml 2015-08-04 14:58:07 +0000
13@@ -60,7 +60,7 @@
14 height: parent.height
15 verticalAlignment: Text.AlignVCenter
16 fontSize: "small"
17- text: i18n.tr("Quick reply with:")
18+ text: i18n.dtr("ubuntu-settings-components", "Quick reply with:")
19 }
20 }
21
22
23=== modified file 'plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml'
24--- plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml 2015-04-22 10:39:31 +0000
25+++ plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml 2015-08-04 14:58:07 +0000
26@@ -27,10 +27,10 @@
27 id: menu
28
29 property bool actionEnabled: true
30- property string actionButtonText: i18n.tr("Call back")
31+ property string actionButtonText: i18n.dtr("ubuntu-settings-components", "Call back")
32
33 property bool replyEnabled: true
34- property string replyButtonText: i18n.tr("Send")
35+ property string replyButtonText: i18n.dtr("ubuntu-settings-components", "Send")
36 property string replyHintText
37 property bool replyExpanded: false
38
39@@ -55,7 +55,7 @@
40
41 Button {
42 objectName: "messageButton"
43- text: i18n.tr("Message")
44+ text: i18n.dtr("ubuntu-settings-components", "Message")
45 Layout.fillWidth: true
46
47 onClicked: {
48
49=== modified file 'plugins/Ubuntu/Settings/Menus/TextMessageMenu.qml'
50--- plugins/Ubuntu/Settings/Menus/TextMessageMenu.qml 2015-04-22 10:39:31 +0000
51+++ plugins/Ubuntu/Settings/Menus/TextMessageMenu.qml 2015-08-04 14:58:07 +0000
52@@ -26,7 +26,7 @@
53 id: menu
54
55 property bool replyEnabled: true
56- property string replyButtonText: i18n.tr("Send")
57+ property string replyButtonText: i18n.dtr("ubuntu-settings-components", "Send")
58 property string replyHintText
59
60 signal replied(string value)
61
62=== added directory 'po'
63=== added file 'po/CMakeLists.txt'
64--- po/CMakeLists.txt 1970-01-01 00:00:00 +0000
65+++ po/CMakeLists.txt 2015-08-04 14:58:07 +0000
66@@ -0,0 +1,33 @@
67+cmake_minimum_required(VERSION 2.8.9)
68+find_package(Gettext REQUIRED)
69+
70+SET(POT_FILE
71+ ubuntu-settings-components.pot
72+)
73+
74+FILE(GLOB PO_FILES
75+ *.po
76+)
77+
78+SET(MO_FILE ubuntu-settings-components.mo)
79+
80+FOREACH(_file ${PO_FILES})
81+ GET_FILENAME_COMPONENT(_lang ${_file} NAME_WE)
82+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
83+ ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile}
84+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_file}
85+ COMMAND install -D ${_gmoFile} ${CMAKE_CURRENT_BINARY_DIR}/locale/${_lang}/LC_MESSAGES/${MO_FILE}
86+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
87+ DEPENDS ${_file}
88+ )
89+ INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo DESTINATION ${CMAKE_INSTALL_PREFIX}/share/locale/${_lang}/LC_MESSAGES/ RENAME ${MO_FILE})
90+ _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
91+ ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFile})
92+ENDFOREACH(_file)
93+
94+ADD_CUSTOM_COMMAND(OUTPUT ${POT_FILE}
95+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/update-usc-pot
96+)
97+ADD_CUSTOM_TARGET(pot_file
98+ DEPENDS ${POT_FILE}
99+)
100
101=== added file 'po/ubuntu-settings-components.pot'
102--- po/ubuntu-settings-components.pot 1970-01-01 00:00:00 +0000
103+++ po/ubuntu-settings-components.pot 2015-08-04 14:58:07 +0000
104@@ -0,0 +1,35 @@
105+# SOME DESCRIPTIVE TITLE.
106+# Copyright (C) YEAR Canonical Ltd.
107+# This file is distributed under the same license as the PACKAGE package.
108+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
109+#
110+#, fuzzy
111+msgid ""
112+msgstr ""
113+"Project-Id-Version: ubuntu-settings-components\n"
114+"Report-Msgid-Bugs-To: \n"
115+"POT-Creation-Date: 2015-08-02 16:26+0200\n"
116+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
117+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
118+"Language-Team: LANGUAGE <LL@li.org>\n"
119+"Language: \n"
120+"MIME-Version: 1.0\n"
121+"Content-Type: text/plain; charset=CHARSET\n"
122+"Content-Transfer-Encoding: 8bit\n"
123+
124+#: plugins/Ubuntu/Settings/Components/QuickReply.qml:63
125+msgid "Quick reply with:"
126+msgstr ""
127+
128+#: plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml:30
129+msgid "Call back"
130+msgstr ""
131+
132+#: plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml:33
133+#: plugins/Ubuntu/Settings/Menus/TextMessageMenu.qml:29
134+msgid "Send"
135+msgstr ""
136+
137+#: plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml:58
138+msgid "Message"
139+msgstr ""
140
141=== added file 'po/update-usc-pot'
142--- po/update-usc-pot 1970-01-01 00:00:00 +0000
143+++ po/update-usc-pot 2015-08-04 14:58:07 +0000
144@@ -0,0 +1,36 @@
145+#!/bin/sh
146+set -e
147+cd $(dirname $0)
148+PO_DIR=$PWD
149+
150+PROGNAME=$(basename $0)
151+
152+# Create a list of files to scan
153+GETTEXT_FILES=$(mktemp --tmpdir usc.lst.XXXXX)
154+trap 'rm -f "$GETTEXT_FILES"' EXIT
155+cd ..
156+find \( -name '*.h' -o -name '*.cpp' -o -name '*.qml' -o -name '*.js' \) \
157+ -a ! \( -path './debian/*' -o -path './builddir/*' -o -path './build/*' -o -path './tests/*' -o -path './.bzr/*' -o -path './examples/*' \) | sort \
158+> $GETTEXT_FILES
159+
160+# Generate pot from our list
161+xgettext \
162+ --output $PO_DIR/ubuntu-settings-components.pot \
163+ --from-code=UTF-8 \
164+ --files-from $GETTEXT_FILES \
165+ --qt --c++ \
166+ --add-comments=Translators \
167+ --keyword=tr \
168+ --keyword=tr:1,2 \
169+ --keyword=dtr:2 \
170+ --keyword=dtr:2,3 \
171+ --keyword=ctr:1c,2 \
172+ --keyword=dctr:2c,3 \
173+ --keyword=tag \
174+ --keyword=tag:1c,2 \
175+ --keyword=dgettext_datetime \
176+ --package-name="ubuntu-settings-components" \
177+ --copyright-holder="Canonical Ltd." \
178+ --from-code="UTF-8"
179+
180+echo "$PROGNAME: $PO_DIR/ubuntu-settings-components.pot updated"

Subscribers

People subscribed via source and target branches

to all changes: