From a6a67ce52090727b8e696e30ec3476bcbfbf2838 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 1 Jan 2012 01:53:44 +0100 Subject: [PATCH] fix build --- .gitignore | 1 - .gitmodules | 4 +- SparkleShare/Windows/Strings.cs | 146 ++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 SparkleShare/Windows/Strings.cs diff --git a/.gitignore b/.gitignore index fd34b967..6c9e3630 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,6 @@ build/m4/shave/shave-libtool SparkleLib/Defines.cs SparkleLib/windows/Defines.cs SparkleLib/windows/GlobalAssemblyInfo.cs -SparkleShare/Windows/Strings.cs SparkleShare/sparkleshare po/sparkleshare.pot SparkleShare/Nautilus/sparkleshare-nautilus-extension.py diff --git a/.gitmodules b/.gitmodules index 47a14910..64010a74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,6 @@ [submodule "tools/TextTemplating"] path = tools/TextTemplating url = git://github.com/wimh/TextTemplating.git -[submodule "tools\\gettext-cs-utils"] - path = tools\\gettext-cs-utils +[submodule "tools/gettext-cs-utils"] + path = tools/gettext-cs-utils url = git://github.com/wimh/gettext-cs-utils.git diff --git a/SparkleShare/Windows/Strings.cs b/SparkleShare/Windows/Strings.cs new file mode 100644 index 00000000..4e545d5e --- /dev/null +++ b/SparkleShare/Windows/Strings.cs @@ -0,0 +1,146 @@ + +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace SparkleShare +{ + public class Strings + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "Strings"; + + private static string resourcesDir = GetSetting("ResourcesDir", "po"); + private static string fileFormat = GetSetting("ResourcesFileFormat", "{{culture}}.po"); + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + + + /// + /// Resources directory used to retrieve files from. + /// + public static string ResourcesDirectory + { + get { return resourcesDir; } + set { resourcesDir = value; } + } + + /// + /// Format of the file based on culture and resource name. + /// + public static string FileFormat + { + get { return fileFormat; } + set { fileFormat = value; } + } + + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { + var directory = resourcesDir; + var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat); + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + +