Skip to content

Commit

Permalink
feat(i18n): setup i18n for swappy
Browse files Browse the repository at this point in the history
This makes swappy more i18n friendly through the use of `gettext` with
`meson` i18n module.
  • Loading branch information
jtheoof committed Jun 24, 2020
1 parent cab6a0e commit 5b3c8ad
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 12 deletions.
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ if libnotify.found()
endif

subdir('res')
subdir('src/po')

executable(
'swappy',
Expand Down
24 changes: 12 additions & 12 deletions res/swappy.glade
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">B</property>
<property name="label" translatable="no">B</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -104,7 +104,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">T</property>
<property name="label" translatable="no">T</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -116,7 +116,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">R</property>
<property name="label" translatable="no">R</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -128,7 +128,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">O</property>
<property name="label" translatable="no">O</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -140,7 +140,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">A</property>
<property name="label" translatable="no">A</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -152,7 +152,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">D</property>
<property name="label" translatable="no">D</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -176,7 +176,7 @@
<property name="homogeneous">True</property>
<child>
<object class="GtkRadioButton" id="brush">
<property name="label" translatable="yes"></property>
<property name="label" translatable="no"></property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
Expand All @@ -192,7 +192,7 @@
</child>
<child>
<object class="GtkRadioButton" id="text">
<property name="label" translatable="yes"></property>
<property name="label" translatable="no"></property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
Expand All @@ -208,7 +208,7 @@
</child>
<child>
<object class="GtkRadioButton" id="rectangle">
<property name="label" translatable="yes"></property>
<property name="label" translatable="no"></property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
Expand All @@ -224,7 +224,7 @@
</child>
<child>
<object class="GtkRadioButton" id="ellipse">
<property name="label" translatable="yes"></property>
<property name="label" translatable="no"></property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
Expand All @@ -240,7 +240,7 @@
</child>
<child>
<object class="GtkRadioButton" id="arrow">
<property name="label" translatable="yes"></property>
<property name="label" translatable="no"></property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
Expand All @@ -256,7 +256,7 @@
</child>
<child>
<object class="GtkRadioButton" id="blur">
<property name="label" translatable="yes"></property>
<property name="label" translatable="no"></property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
Expand Down
2 changes: 2 additions & 0 deletions src/po/LINGUAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set of available languages.
en
1 change: 1 addition & 0 deletions src/po/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
res/swappy.glade
50 changes: 50 additions & 0 deletions src/po/en.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# English translations for swappy package.
# Copyright (C) 2020 THE swappy'S COPYRIGHT HOLDER
# This file is distributed under the same license as the swappy package.
# Automatically generated, 2020.
#
msgid ""
msgstr ""
"Project-Id-Version: swappy\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-06-21 21:57-0400\n"
"PO-Revision-Date: 2020-06-21 21:57-0400\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: res/swappy.glade:455
msgid "Line Width"
msgstr "Line Width"

#: res/swappy.glade:525
msgid "Text Size"
msgstr "Text Size"

#: res/swappy.glade:641
msgid "Toggle Paint Panel"
msgstr "Toggle Paint Panel"

#: res/swappy.glade:667
msgid "Undo Last Paint"
msgstr "Undo Last Paint"

#: res/swappy.glade:686
msgid "Redo Previous Paint"
msgstr "Redo Previous Paint"

#: res/swappy.glade:705
msgid "Clear Paints"
msgstr "Clear Paints"

#: res/swappy.glade:733
msgid "Copy Surface"
msgstr "Copy Surface"

#: res/swappy.glade:749
msgid "Save Surface"
msgstr "Save Surface"
8 changes: 8 additions & 0 deletions src/po/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
i18n = import('i18n')

# define GETTEXT_PACKAGE
add_project_arguments('-DGETTEXT_PACKAGE="intltest"', language:'c')

i18n.gettext(meson.project_name(),
args: '--directory=' + meson.source_root()
)
50 changes: 50 additions & 0 deletions src/po/swappy.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the swappy package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: swappy\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-06-21 21:57-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: res/swappy.glade:455
msgid "Line Width"
msgstr ""

#: res/swappy.glade:525
msgid "Text Size"
msgstr ""

#: res/swappy.glade:641
msgid "Toggle Paint Panel"
msgstr ""

#: res/swappy.glade:667
msgid "Undo Last Paint"
msgstr ""

#: res/swappy.glade:686
msgid "Redo Previous Paint"
msgstr ""

#: res/swappy.glade:705
msgid "Clear Paints"
msgstr ""

#: res/swappy.glade:733
msgid "Copy Surface"
msgstr ""

#: res/swappy.glade:749
msgid "Save Surface"
msgstr ""

0 comments on commit 5b3c8ad

Please sign in to comment.