Skip to content

Commit

Permalink
Migrate from intltool to gettext
Browse files Browse the repository at this point in the history
  • Loading branch information
yetist authored and raveit65 committed May 16, 2019
1 parent 8f46993 commit 3324c28
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 98 deletions.
7 changes: 3 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

SUBDIRS=src po doc
SUBDIRS = po src doc

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}

EXTRA_DIST = autogen.sh HACKING rationales.txt \
intltool-extract.in intltool-merge.in intltool-update.in
EXTRA_DIST = its autogen.sh HACKING rationales.txt

DISTCLEANFILES = intltool-extract intltool-merge intltool-update po/stamp-it po/.intltool-merge-cache
DISTCLEANFILES = po/stamp-it

# Build ChangeLog from GIT history
ChangeLog:
Expand Down
5 changes: 2 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ GETTEXT_PACKAGE=marco
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Name of default gettext domain])

IT_PROG_INTLTOOL([0.50.1])
AM_GNU_GETTEXT_VERSION([0.19.8])
AM_GNU_GETTEXT([external])
AC_PROG_CC
AC_HEADER_STDC
AM_PROG_LIBTOOL
Expand Down Expand Up @@ -153,8 +154,6 @@ AC_ARG_ENABLE(shape,
## try definining HAVE_BACKTRACE
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])

AM_GLIB_GNU_GETTEXT

PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.58.0)
PKG_CHECK_MODULES(MARCO_MESSAGE, gtk+-3.0 >= $GTK_MIN_VERSION)
PKG_CHECK_MODULES(MARCO_WINDOW_DEMO, gtk+-3.0 >= $GTK_MIN_VERSION)
Expand Down
15 changes: 15 additions & 0 deletions its/marco-keybindings.its
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
xmlns:gt="https://www.gnu.org/s/gettext/ns/its/extensions/1.0"
version="2.0">
<its:translateRule selector="/KeyListEntries" translate="no"/>
<its:translateRule selector="/KeyListEntries/@name" translate="yes"/>
<its:translateRule selector="//KeyListEntry" translate="yes"/>
<its:translateRule selector="//KeyListEntry/@description" translate="yes"/>

<gt:contextRule selector="//KeyListEntry[@msgctxt]" contextPointer="@msgctxt"/>

<!-- Extracted strings are consumed by the library and are never
merged back; we don't want to escape special characters. -->
<gt:escapeRule selector="/KeyListEntries" escape="no"/>
</its:rules>
6 changes: 6 additions & 0 deletions its/marco-keybindings.loc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<locatingRules>
<locatingRule name="MarcoKeybindings" pattern="*.xml">
<documentRule localName="KeyListEntries" target="marco-keybindings.its"/>
</locatingRule>
</locatingRules>
79 changes: 79 additions & 0 deletions po/Makevars
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Makefile variables for PO directory in any package using GNU gettext.

# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)

# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..

# These options get passed to xgettext.
XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments

# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = MATE Desktop Environment team

# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU =

# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =

# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no

# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =

# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =

# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = yes

# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = yes
$(DOMAIN).pot-update: export GETTEXTDATADIR = $(top_srcdir)
2 changes: 1 addition & 1 deletion po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
src/50-marco-desktop-key.xml.in
src/50-marco-global-key.xml.in
src/50-marco-window-key.xml.in
[type: gettext/gsettings]src/org.mate.marco.gschema.xml
src/org.mate.marco.gschema.xml
src/core/bell.c
src/core/core.c
src/core/delete.c
Expand Down
14 changes: 7 additions & 7 deletions src/50-marco-desktop-key.xml.in
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<KeyListEntries _name="Desktop" wm_name="Metacity (Marco)" package="marco" schema="org.mate.Marco.global-keybindings">
<KeyListEntries name="Desktop" wm_name="Metacity (Marco)" package="marco" schema="org.mate.Marco.global-keybindings">

<KeyListEntry name="panel-run-dialog" _description="Show the panel's &quot;Run Application&quot; dialog box" />
<KeyListEntry name="panel-run-dialog" description="Show the panel's &quot;Run Application&quot; dialog box" />

<KeyListEntry name="panel-main-menu" _description="Show the panel's main menu" />
<KeyListEntry name="panel-main-menu" description="Show the panel's main menu" />

<KeyListEntry name="run-command-screenshot" _description="Take a screenshot" />
<KeyListEntry name="run-command-screenshot" description="Take a screenshot" />

<KeyListEntry name="run-command-window-screenshot" _description="Take a screenshot of a window" />
<KeyListEntry name="run-command-window-screenshot" description="Take a screenshot of a window" />

<KeyListEntry name="run-command-terminal" _description="Run a terminal" />
<KeyListEntry name="run-command-terminal" description="Run a terminal" />

<KeyListEntry name="rename-workspace" _description="Rename current workspace" />
<KeyListEntry name="rename-workspace" description="Rename current workspace" />

</KeyListEntries>

50 changes: 25 additions & 25 deletions src/50-marco-global-key.xml.in
Original file line number Diff line number Diff line change
@@ -1,134 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<KeyListEntries _name="Window Management" wm_name="Metacity (Marco)" package="marco" schema="org.mate.Marco.global-keybindings">
<KeyListEntries name="Window Management" wm_name="Metacity (Marco)" package="marco" schema="org.mate.Marco.global-keybindings">

<KeyListEntry name="switch-windows" _description="Move between windows, using a popup window" />
<KeyListEntry name="switch-windows" description="Move between windows, using a popup window" />

<KeyListEntry name="switch-group" _description="Move between windows of an application, using a popup window" />
<KeyListEntry name="switch-group" description="Move between windows of an application, using a popup window" />

<KeyListEntry name="switch-panels" _description="Move between panels and the desktop, using a popup window" />
<KeyListEntry name="switch-panels" description="Move between panels and the desktop, using a popup window" />

<KeyListEntry name="cycle-windows" _description="Move between windows immediately" />
<KeyListEntry name="cycle-windows" description="Move between windows immediately" />

<KeyListEntry name="cycle-group" _description="Move between windows of an application immediately" />
<KeyListEntry name="cycle-group" description="Move between windows of an application immediately" />

<KeyListEntry name="cycle-panels" _description="Move between panels and the desktop immediately" />
<KeyListEntry name="cycle-panels" description="Move between panels and the desktop immediately" />

<KeyListEntry name="show-desktop" _description="Hide all normal windows and set focus to the desktop" />
<KeyListEntry name="show-desktop" description="Hide all normal windows and set focus to the desktop" />

<KeyListEntry name="switch-to-workspace-1"
_description="Switch to workspace 1"
description="Switch to workspace 1"
value="1"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-2"
_description="Switch to workspace 2"
description="Switch to workspace 2"
value="1"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-3"
_description="Switch to workspace 3"
description="Switch to workspace 3"
value="2"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-4"
_description="Switch to workspace 4"
description="Switch to workspace 4"
value="3"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-5"
_description="Switch to workspace 5"
description="Switch to workspace 5"
value="4"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-6"
_description="Switch to workspace 6"
description="Switch to workspace 6"
value="5"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-7"
_description="Switch to workspace 7"
description="Switch to workspace 7"
value="6"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-8"
_description="Switch to workspace 8"
description="Switch to workspace 8"
value="7"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-9"
_description="Switch to workspace 9"
description="Switch to workspace 9"
value="8"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-10"
_description="Switch to workspace 10"
description="Switch to workspace 10"
value="9"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-11"
_description="Switch to workspace 11"
description="Switch to workspace 11"
value="10"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-12"
_description="Switch to workspace 12"
description="Switch to workspace 12"
value="11"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-left"
_description="Switch to workspace on the left of the current workspace"
description="Switch to workspace on the left of the current workspace"
value="1"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-right"
_description="Switch to workspace on the right of the current workspace"
description="Switch to workspace on the right of the current workspace"
value="1"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-up"
_description="Switch to workspace above the current workspace"
description="Switch to workspace above the current workspace"
value="1"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-down"
_description="Switch to workspace below the current workspace"
description="Switch to workspace below the current workspace"
value="1"
key="num-workspaces"
schema="org.mate.Marco.general"
comparison="gt" />

<KeyListEntry name="switch-to-workspace-prev"
_description="Switch to previously selected workspace" />
description="Switch to previously selected workspace" />

</KeyListEntries>

Loading

0 comments on commit 3324c28

Please sign in to comment.