[f-spot] Initial attempt to make add-ins descriptions translatable
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Initial attempt to make add-ins descriptions translatable
- Date: Thu, 21 Oct 2010 11:49:43 +0000 (UTC)
commit 661e15e13941973909842edde1782aa646b373ab
Author: Jonh Wendell <jwendell gnome org>
Date: Fri Sep 24 10:21:39 2010 -0300
Initial attempt to make add-ins descriptions translatable
https://bugzilla.gnome.org/show_bug.cgi?id=630511
build/AddinXmlStringExtractor.cs | 47 ++++++++++++++++++++++++++++++++++++++
build/Makefile.am | 9 +++++-
data/Makefile.am | 13 ++++++++++
po/POTFILES.in | 1 +
4 files changed, 68 insertions(+), 2 deletions(-)
---
diff --git a/build/AddinXmlStringExtractor.cs b/build/AddinXmlStringExtractor.cs
new file mode 100644
index 0000000..d10a8ac
--- /dev/null
+++ b/build/AddinXmlStringExtractor.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+public static class AddinXmlStringExtract
+{
+ public static void Main (string [] args)
+ {
+ var queries = new [] {
+ "/Addin/@name",
+ "/Addin/@description",
+ "/Addin/@category"
+ };
+
+ Console.WriteLine (@"// Generated - Do Not Edit!
+
+internal static class AddinXmlStringCatalog
+{
+ private static void Strings ()
+ {");
+
+ var paths = new List<string> (args);
+ paths.Sort ();
+
+ foreach (var path in paths) {
+ Console.WriteLine (" // {0}", path);
+ var xpath = new XPathDocument (path);
+ var nav = xpath.CreateNavigator ();
+ foreach (var query in queries) {
+ var iter = nav.Select (query);
+ while (iter.MoveNext ()) {
+ var value = iter.Current.Value.Trim ();
+ if (String.IsNullOrEmpty (value) ||
+ value[0] == '@' ||
+ (iter.Current.Name == "category" && value.StartsWith ("required:"))) {
+ continue;
+ }
+ Console.WriteLine (@" Catalog.GetString (@""{0}"");",
+ value.Replace (@"""", @""""""));
+ }
+ }
+ Console.WriteLine ();
+ }
+
+ Console.WriteLine (" }\n}");
+ }
+}
diff --git a/build/Makefile.am b/build/Makefile.am
index 9ae1045..4e9db7d 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,18 +1,23 @@
SUBDIRS = pkg-config m4
DLL_MAP_VERIFIER_ASSEMBLY = dll-map-verifier.exe
+ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY = addin-xml-string-extractor.exe
-ALL_TARGETS = $(DLL_MAP_VERIFIER_ASSEMBLY)
+ALL_TARGETS = $(DLL_MAP_VERIFIER_ASSEMBLY) $(ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY)
all: $(ALL_TARGETS)
$(DLL_MAP_VERIFIER_ASSEMBLY): DllMapVerifier.cs
$(MCS) -out:$@ $<
+$(ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY): AddinXmlStringExtractor.cs
+ $(MCS) -r:System.Xml -out:$@ $<
+
EXTRA_DIST = \
private-icon-theme-installer \
DllMapVerifier.cs \
- dll-map-makefile-verifier
+ dll-map-makefile-verifier \
+ AddinXmlStringExtractor.cs
CLEANFILES = *.exe *.mdb
MAINTAINERCLEANFILES = Makefile.in
diff --git a/data/Makefile.am b/data/Makefile.am
index a3d7d21..959e761 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1 +1,14 @@
SUBDIRS = desktop-files
+
+# Generate a fake source file containing strings for
+# translation that are found in our .addin.xml files
+ADDIN_XML_FILES = $(shell find $(top_srcdir)/src -name \*.addin.xml | grep -v /obj/)
+addin-xml-strings.cs: $(ADDIN_XML_FILES) $(top_srcdir)/build/addin-xml-string-extractor.exe
+ @echo " GEN $@"
+ $(MONO) $(top_srcdir)/build/addin-xml-string-extractor.exe $(ADDIN_XML_FILES) > $@
+
+all: addin-xml-strings.cs
+
+EXTRA_DIST = \
+ addin-xml-strings.cs
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4913f14..6970545 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,6 +2,7 @@
# Please keep this file in alphabetical order; run ./sort-potfiles
# after adding files here.
[encoding: UTF-8]
+data/addin-xml-strings.cs
data/desktop-files/f-spot.desktop.in.in
data/desktop-files/f-spot.desktop.in.in
data/desktop-files/f-spot-import.desktop.in.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]