[librsvg: 1/3] Add localization support with gettext



commit 813e61a04d525bf3f201ed2a061fb91b607cfea9
Author: Daniel García Moreno <danigm wadobo com>
Date:   Thu Nov 29 10:28:42 2018 +0100

    Add localization support with gettext
    
    This patch add gettext to the configure.ac to manage translations. I've
    created the po directory with all c and rust files in the POTFILES.in
    and an initial spanish translation.
    
    See #386

 Makefile.am    |   2 +-
 configure.ac   |  11 ++++++
 po/LINGUAS     |   4 +++
 po/Makevars    |  78 ++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in |  93 ++++++++++++++++++++++++++++++++++++++++++++++++++
 po/es.po       | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 po/librsvg.pot | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 398 insertions(+), 1 deletion(-)
---
diff --git a/Makefile.am b/Makefile.am
index 515518a3..ec8a4dd5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . gdk-pixbuf-loader tests tools doc win32
+SUBDIRS = . gdk-pixbuf-loader tests tools doc win32 po
 
 NULL =
 BUILT_SOURCES =
diff --git a/configure.ac b/configure.ac
index ece758bd..6227aa39 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,16 @@ AC_SUBST([LIBRSVG_MAJOR_VERSION],[rsvg_major_version])
 AC_SUBST([LIBRSVG_MINOR_VERSION],[rsvg_minor_version])
 AC_SUBST([LIBRSVG_MICRO_VERSION],[rsvg_micro_version])
 
+dnl ===========================================================================
+dnl Gettext stuff
+dnl ===========================================================================
+
+AM_GNU_GETTEXT_VERSION([0.19.8])
+AM_GNU_GETTEXT([external])
+
+AC_SUBST([GETTEXT_PACKAGE], [librsvg])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Define to the gettext package name.])
+
 dnl ===========================================================================
 dnl Please update COMPILING.md with version numbers if these change
 CAIRO_REQUIRED=1.15.12
@@ -373,6 +383,7 @@ win32/vs12/Makefile
 win32/vs12/rsvg-version-paths.props
 win32/vs14/Makefile
 win32/vs15/Makefile
+po/Makefile.in
 ])
 
 AC_CONFIG_FILES([librsvg-${RSVG_API_VERSION}.pc:librsvg.pc.in],[],[RSVG_API_VERSION=$RSVG_API_VERSION])
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 00000000..fabc6fc3
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1,4 @@
+#
+# librsvg translations
+# please keep this list sorted alphabetically
+es
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 00000000..a2c6e0c5
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,78 @@
+# 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 --keyword=Description --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 = The librsvg authors
+
+# 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 = https://gitlab.gnome.org/GNOME/librsvg/issues
+
+# 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 = yes
+
+# 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 = no
+
+# 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 = no
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 00000000..061dcfec
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,93 @@
+# List of source files containing translatable strings.
+# Please keep this file sorted alphabetically.
+librsvg/librsvg-enum-types.c
+librsvg/librsvg-features.c
+librsvg/rsvg-base.c
+librsvg/rsvg-handle.c
+librsvg/rsvg-load.c
+librsvg/rsvg-pixbuf.c
+librsvg/rsvg-size-callback.c
+librsvg/s-enum-types-c
+rsvg_internals/benches/box_blur.rs
+rsvg_internals/benches/composite.rs
+rsvg_internals/benches/lighting.rs
+rsvg_internals/benches/pixel_iterators.rs
+rsvg_internals/benches/srgb.rs
+rsvg_internals/build.rs
+rsvg_internals/src/allowed_url.rs
+rsvg_internals/src/aspect_ratio.rs
+rsvg_internals/src/attributes.rs
+rsvg_internals/src/bbox.rs
+rsvg_internals/src/clip_path.rs
+rsvg_internals/src/color.rs
+rsvg_internals/src/cond.rs
+rsvg_internals/src/coord_units.rs
+rsvg_internals/src/create_node.rs
+rsvg_internals/src/croco.rs
+rsvg_internals/src/css.rs
+rsvg_internals/src/defs.rs
+rsvg_internals/src/drawing_ctx.rs
+rsvg_internals/src/error.rs
+rsvg_internals/src/filters/blend.rs
+rsvg_internals/src/filters/bounds.rs
+rsvg_internals/src/filters/color_matrix.rs
+rsvg_internals/src/filters/component_transfer.rs
+rsvg_internals/src/filters/composite.rs
+rsvg_internals/src/filters/context.rs
+rsvg_internals/src/filters/convolve_matrix.rs
+rsvg_internals/src/filters/displacement_map.rs
+rsvg_internals/src/filters/error.rs
+rsvg_internals/src/filters/flood.rs
+rsvg_internals/src/filters/gaussian_blur.rs
+rsvg_internals/src/filters/image.rs
+rsvg_internals/src/filters/input.rs
+rsvg_internals/src/filters/light/light_source.rs
+rsvg_internals/src/filters/light/lighting.rs
+rsvg_internals/src/filters/light/mod.rs
+rsvg_internals/src/filters/merge.rs
+rsvg_internals/src/filters/mod.rs
+rsvg_internals/src/filters/morphology.rs
+rsvg_internals/src/filters/node.rs
+rsvg_internals/src/filters/offset.rs
+rsvg_internals/src/filters/tile.rs
+rsvg_internals/src/filters/turbulence.rs
+rsvg_internals/src/float_eq_cairo.rs
+rsvg_internals/src/font_props.rs
+rsvg_internals/src/gradient.rs
+rsvg_internals/src/handle.rs
+rsvg_internals/src/image.rs
+rsvg_internals/src/io.rs
+rsvg_internals/src/iri.rs
+rsvg_internals/src/length.rs
+rsvg_internals/src/lib.rs
+rsvg_internals/src/link.rs
+rsvg_internals/src/log.rs
+rsvg_internals/src/marker.rs
+rsvg_internals/src/mask.rs
+rsvg_internals/src/node.rs
+rsvg_internals/src/paint_server.rs
+rsvg_internals/src/parsers.rs
+rsvg_internals/src/path_builder.rs
+rsvg_internals/src/path_parser.rs
+rsvg_internals/src/pattern.rs
+rsvg_internals/src/property_bag.rs
+rsvg_internals/src/property_macros.rs
+rsvg_internals/src/rect.rs
+rsvg_internals/src/shapes.rs
+rsvg_internals/src/space.rs
+rsvg_internals/src/srgb.rs
+rsvg_internals/src/state.rs
+rsvg_internals/src/stop.rs
+rsvg_internals/src/structure.rs
+rsvg_internals/src/style.rs
+rsvg_internals/src/surface_utils/iterators.rs
+rsvg_internals/src/surface_utils/mod.rs
+rsvg_internals/src/surface_utils/shared_surface.rs
+rsvg_internals/src/text.rs
+rsvg_internals/src/transform.rs
+rsvg_internals/src/tree.rs
+rsvg_internals/src/unitinterval.rs
+rsvg_internals/src/util.rs
+rsvg_internals/src/viewbox.rs
+rsvg_internals/src/viewport.rs
+rsvg_internals/src/xml.rs
diff --git a/po/es.po b/po/es.po
new file mode 100644
index 00000000..f28684d2
--- /dev/null
+++ b/po/es.po
@@ -0,0 +1,106 @@
+# Librsvg.
+# Copyright (C) YEAR The librsvg authors
+# This file is distributed under the same license as the librsvg package.
+# danigm <danigm gnome org>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: librsvg 2.45.0\n"
+"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/librsvg/issues\n";
+"POT-Creation-Date: 2018-11-29 10:16+0100\n"
+"PO-Revision-Date: 2018-11-29 10:27+0100\n"
+"Last-Translator: danigm <danigm gnome org>\n"
+"Language-Team: Spanish; Castilian <es gnome org>\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"X-Generator: Gtranslator 3.30.1\n"
+
+#: librsvg/rsvg-base.c:150
+#, c-format
+msgid "%s: assertion `%s' failed"
+msgstr "%s: comprobación `%s' fallida"
+
+#: librsvg/rsvg-handle.c:307 librsvg/rsvg-handle.c:308
+msgid "Horizontal resolution"
+msgstr "Resolución horizontal"
+
+#: librsvg/rsvg-handle.c:315 librsvg/rsvg-handle.c:316
+msgid "Vertical resolution"
+msgstr "Resolución vertical"
+
+#: librsvg/rsvg-handle.c:323 librsvg/rsvg-handle.c:324
+msgid "Base URI"
+msgstr "URI base"
+
+#: librsvg/rsvg-handle.c:330 librsvg/rsvg-handle.c:331
+msgid "Image width"
+msgstr "Ancho de imagen"
+
+#: librsvg/rsvg-handle.c:336 librsvg/rsvg-handle.c:337
+msgid "Image height"
+msgstr "Alto de Imagen"
+
+#: librsvg/rsvg-handle.c:342 librsvg/rsvg-handle.c:343
+msgid "em"
+msgstr "em"
+
+#: librsvg/rsvg-handle.c:348 librsvg/rsvg-handle.c:349
+msgid "ex"
+msgstr "ex"
+
+#: librsvg/rsvg-handle.c:361
+msgid "Title"
+msgstr "Título"
+
+#: librsvg/rsvg-handle.c:362
+msgid "SVG file title"
+msgstr "Título de fichero SVG"
+
+#: librsvg/rsvg-handle.c:374
+msgid "Description"
+msgstr "Descripción"
+
+#: librsvg/rsvg-handle.c:375
+msgid "SVG file description"
+msgstr "Descripción de fichero SVG"
+
+#: librsvg/rsvg-handle.c:387
+msgid "Metadata"
+msgstr "Metadatos"
+
+#: librsvg/rsvg-handle.c:388
+msgid "SVG file metadata"
+msgstr "Metadatos de fichero SVG"
+
+#: librsvg/rsvg-handle.c:504
+#, c-format
+msgid "Cannot obtain URI from '%s'"
+msgstr "No se puede obtener URI desde '%s'"
+
+#: librsvg/rsvg-handle.c:666
+msgid "SVG has no elements"
+msgstr "SVG no tiene elementos"
+
+#: librsvg/rsvg-handle.c:671
+msgid "root element is not <svg>"
+msgstr "el elemento raíz no es <svg>"
+
+#: librsvg/rsvg-handle.c:740
+msgid "no data passed to parser"
+msgstr "no se han pasado datos para el parser"
+
+#: librsvg/rsvg-load.c:267
+msgid "Error creating XML parser"
+msgstr "Error creando el parser XML"
+
+#: librsvg/rsvg-load.c:577
+#, c-format
+msgid "Error domain %d code %d on line %d column %d of %s: %s"
+msgstr "Error dominio %d código %d en la línea %d columna %d de %s: %s"
+
+#: librsvg/rsvg-load.c:583
+msgid "Error parsing XML data"
+msgstr "Error analizando datos XML"
diff --git a/po/librsvg.pot b/po/librsvg.pot
new file mode 100644
index 00000000..57d5daa5
--- /dev/null
+++ b/po/librsvg.pot
@@ -0,0 +1,105 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR The librsvg authors
+# This file is distributed under the same license as the librsvg package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: librsvg 2.45.0\n"
+"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/librsvg/issues\n";
+"POT-Creation-Date: 2018-11-29 10:16+0100\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"
+
+#: librsvg/rsvg-base.c:150
+#, c-format
+msgid "%s: assertion `%s' failed"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:307 librsvg/rsvg-handle.c:308
+msgid "Horizontal resolution"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:315 librsvg/rsvg-handle.c:316
+msgid "Vertical resolution"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:323 librsvg/rsvg-handle.c:324
+msgid "Base URI"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:330 librsvg/rsvg-handle.c:331
+msgid "Image width"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:336 librsvg/rsvg-handle.c:337
+msgid "Image height"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:342 librsvg/rsvg-handle.c:343
+msgid "em"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:348 librsvg/rsvg-handle.c:349
+msgid "ex"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:361
+msgid "Title"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:362
+msgid "SVG file title"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:374
+msgid "Description"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:375
+msgid "SVG file description"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:387
+msgid "Metadata"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:388
+msgid "SVG file metadata"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:504
+#, c-format
+msgid "Cannot obtain URI from '%s'"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:666
+msgid "SVG has no elements"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:671
+msgid "root element is not <svg>"
+msgstr ""
+
+#: librsvg/rsvg-handle.c:740
+msgid "no data passed to parser"
+msgstr ""
+
+#: librsvg/rsvg-load.c:267
+msgid "Error creating XML parser"
+msgstr ""
+
+#: librsvg/rsvg-load.c:577
+#, c-format
+msgid "Error domain %d code %d on line %d column %d of %s: %s"
+msgstr ""
+
+#: librsvg/rsvg-load.c:583
+msgid "Error parsing XML data"
+msgstr ""


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]