Skip to content

Commit

Permalink
Merge pull request #21 from zchydem/master
Browse files Browse the repository at this point in the history
[transfer-engine] Updated example share plugin to use translations.
  • Loading branch information
Marko Mattila committed Jun 2, 2014
2 parents c8e368b + ba2b577 commit 2c68e58
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 11 deletions.
9 changes: 6 additions & 3 deletions example/ExampleShareUI.qml
Expand Up @@ -61,7 +61,9 @@ ShareDialog {
Label {
anchors.centerIn:parent
width: viewWidth
text: "Example Test Share UI"
//: Label for example share UI
//% "Example Test Share UI"
text: qsTrId("example-test-share-ui-la-id")
horizontalAlignment: Text.AlignHCenter
}
}
Expand All @@ -77,8 +79,9 @@ ShareDialog {
}

DialogHeader {
// TODO: Localization not supported for 3rd party plugins yet
acceptText: "Example Share"
//: Header for example share plugin
//% "Example Share"
acceptText: qsTrId("example-share-he-id")
}
}

21 changes: 15 additions & 6 deletions example/example.pro
Expand Up @@ -20,14 +20,12 @@ SOURCES += \
OTHER_FILES += \
ExampleShareUI.qml


shareui.files = *.qml
shareui.path = /usr/share/nemo-transferengine/plugins

target.path = /usr/lib/nemo-transferengine/plugins
INSTALLS += target shareui


TS_FILE = $$OUT_PWD/example_share_plugin.ts
EE_QM = $$OUT_PWD/example_share_plugin_eng_en.qm

Expand All @@ -47,17 +45,28 @@ engineering_english.depends = ts
engineering_english.input = $$TS_FILE
engineering_english.output = $$EE_QM

engineering_english_install.path = /usr/share/translations
engineering_english_install.path = /usr/share/translations/nemotransferengine
engineering_english_install.files = $$EE_QM
engineering_english_install.CONFIG += no_check_exist

QMAKE_EXTRA_TARGETS += ts engineering_english
TS_FI_FILE = translations/example_share_plugin_fi.ts
QM_FI_FILE = example_share_plugin_fi.qm

finnish.commands += lrelease -idbased $$TS_FI_FILE -qm $$QM_FI_FILE
finnish.CONFIG += no_check_exist no_link
finnish.depends = ts
finnish.input = $$TS_FI_FILE
finnish.output = $$QM_FI_FILE

PRE_TARGETDEPS += ts engineering_english
finnish_install.path = /usr/share/translations/nemotransferengine
finnish_install.files = $$QM_FI_FILE
finnish_install.CONFIG += no_check_exist

INSTALLS += ts_install engineering_english_install
QMAKE_EXTRA_TARGETS += ts engineering_english finnish

PRE_TARGETDEPS += ts engineering_english finnish

INSTALLS += ts_install engineering_english_install finnish_install

OTHER_FILES += \
rpm/*
Expand Down
4 changes: 3 additions & 1 deletion example/exampleplugininfo.cpp
Expand Up @@ -57,7 +57,9 @@ void ExamplePluginInfo::query()
// TODO: Translations for 3rd party plugins is not yet supported by Sailfish OS.
// Adding support there later, but for now just use what ever non-translated
// string here. This string will be visible in the share method list.
info.displayName = "Example Display Name";
//: Display name for example share plugin
//% "Example plugin"
info.displayName = qtTrId("example-localization-li-id");

// Method ID is a unique identifier for this plugin. It is used to identify which share plugin should be
// used for starting the sharing.
Expand Down
2 changes: 1 addition & 1 deletion example/rpm/example.spec
Expand Up @@ -22,7 +22,7 @@ Requires: declarative-transferengine-qt5 >= 0.0.44
%defattr(-,root,root,-)
%{_libdir}/nemo-transferengine/plugins/*shareplugin.so
%{_datadir}/nemo-transferengine/plugins/*.qml
%{_datadir}/translations/example_share_plugin_eng_en.qm
%{_datadir}/translations/nemotransferengine/*.qm

%package ts-devel
Summary: Translation source for Transfer Engine share plugins
Expand Down
32 changes: 32 additions & 0 deletions example/translations/example_share_plugin_fi.ts
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fi_FI">
<context>
<name></name>
<message id="example-test-share-ui-la-id">
<location filename="ExampleShareUI.qml" line="65"/>
<source>Example Test Share UI</source>
<translation>Esimerkki testi UI</translation>
</message>
<message id="example-share-he-id">
<location filename="ExampleShareUI.qml" line="83"/>
<source>Example Share</source>
<extracomment>Header for example share plugin</extracomment>
<translation>Jakoesimerkki</translation>
</message>
<message id="example-localization-li-id">
<location filename="exampleplugininfo.cpp" line="62"/>
<source>Example plugin</source>
<extracomment>Display name for example share plugin</extracomment>
<translation>Esimerkkiplugari</translation>
</message>
</context>
<context>
<name>ExampleUploader</name>
<message>
<location filename="exampleuploader.cpp" line="45"/>
<source>Example</source>
<translation>Esimerkki</translation>
</message>
</context>
</TS>

0 comments on commit 2c68e58

Please sign in to comment.