From a78ab7ccdb6a023e4536a56e6b101fa13f68856b Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 26 Sep 2016 15:28:40 +0100 Subject: [PATCH] Reverted Localisation interface --- .../Fungus/Scripts/Components/Localization.cs | 33 +++++++- .../Fungus/Scripts/Interfaces/ILocalizable.cs | 35 ++++++++ ...alization.cs.meta => ILocalizable.cs.meta} | 0 .../Scripts/Interfaces/ILocalization.cs | 83 ------------------- 4 files changed, 66 insertions(+), 85 deletions(-) create mode 100644 Assets/Fungus/Scripts/Interfaces/ILocalizable.cs rename Assets/Fungus/Scripts/Interfaces/{ILocalization.cs.meta => ILocalizable.cs.meta} (100%) delete mode 100644 Assets/Fungus/Scripts/Interfaces/ILocalization.cs diff --git a/Assets/Fungus/Scripts/Components/Localization.cs b/Assets/Fungus/Scripts/Components/Localization.cs index 68a45b73..bde6070a 100644 --- a/Assets/Fungus/Scripts/Components/Localization.cs +++ b/Assets/Fungus/Scripts/Components/Localization.cs @@ -16,7 +16,7 @@ namespace Fungus /// /// Multi-language localization support. /// - public class Localization : MonoBehaviour, ILocalization, ISubstitutionHandler + public class Localization : MonoBehaviour, ISubstitutionHandler { /// /// Temp storage for a single item of standard text and its localizations. @@ -247,19 +247,34 @@ namespace Fungus } } - #region ILocalization interface + #region Public methods + /// + /// Language to use at startup, usually defined by a two letter language code (e.g DE = German). + /// public virtual string ActiveLanguage { get { return activeLanguage; } } + /// + /// CSV file containing localization data which can be easily edited in a spreadsheet tool. + /// public virtual TextAsset LocalizationFile { get { return localizationFile; } set { localizationFile = value; } } + /// + /// Stores any notification message from export / import methods. + /// public virtual string NotificationText { get { return notificationText; } set { notificationText = value; } } + /// + /// Clears the cache of localizeable objects. + /// public virtual void ClearLocalizeableCache() { localizeableObjects.Clear(); } + /// + /// Convert all text items and localized strings to an easy to edit CSV format. + /// public virtual string GetCSVData() { // Collect all the text items present in the scene @@ -319,6 +334,10 @@ namespace Fungus return csvData; } + /// + /// Scan a localization CSV file and copies the strings for the specified language code + /// into the text properties of the appropriate scene objects. + /// public virtual void SetActiveLanguage(string languageCode, bool forceUpdateSceneText = false) { if (!Application.isPlaying) @@ -411,6 +430,9 @@ namespace Fungus } } + /// + /// Populates the text property of a single scene object with a new text value. + /// public virtual bool PopulateTextProperty(string stringId, string newText) { // Ensure that all localizeable objects have been cached @@ -430,6 +452,10 @@ namespace Fungus return false; } + /// + /// Returns all standard text for localizeable text in the scene using an + /// easy to edit custom text format. + /// public virtual string GetStandardText() { // Collect all the text items present in the scene @@ -451,6 +477,9 @@ namespace Fungus return textData; } + /// + /// Sets standard text on scene objects by parsing a text data file. + /// public virtual void SetStandardText(string textData) { string[] lines = textData.Split('\n'); diff --git a/Assets/Fungus/Scripts/Interfaces/ILocalizable.cs b/Assets/Fungus/Scripts/Interfaces/ILocalizable.cs new file mode 100644 index 00000000..47dd863b --- /dev/null +++ b/Assets/Fungus/Scripts/Interfaces/ILocalizable.cs @@ -0,0 +1,35 @@ +// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). +// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) + +using UnityEngine; + +namespace Fungus +{ + /// + /// An item of localizeable text. + /// + public interface ILocalizable + { + /// + /// Gets the standard (non-localized) text. + /// + string GetStandardText(); + + /// + /// Sets the standard (non-localized) text. + /// + /// Standard text. + void SetStandardText(string standardText); + + /// + /// Gets the description used to help localizers. + /// + /// The description. + string GetDescription(); + + /// + /// Gets the unique string identifier. + /// + string GetStringId(); + } +} diff --git a/Assets/Fungus/Scripts/Interfaces/ILocalization.cs.meta b/Assets/Fungus/Scripts/Interfaces/ILocalizable.cs.meta similarity index 100% rename from Assets/Fungus/Scripts/Interfaces/ILocalization.cs.meta rename to Assets/Fungus/Scripts/Interfaces/ILocalizable.cs.meta diff --git a/Assets/Fungus/Scripts/Interfaces/ILocalization.cs b/Assets/Fungus/Scripts/Interfaces/ILocalization.cs deleted file mode 100644 index bbc5cd71..00000000 --- a/Assets/Fungus/Scripts/Interfaces/ILocalization.cs +++ /dev/null @@ -1,83 +0,0 @@ -// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). -// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) - -using UnityEngine; - -namespace Fungus -{ - /// - /// Multi-language localization support. - /// - public interface ILocalization - { - /// - /// Language to use at startup, usually defined by a two letter language code (e.g DE = German). - /// - string ActiveLanguage { get; } - - /// - /// CSV file containing localization data which can be easily edited in a spreadsheet tool. - /// - TextAsset LocalizationFile { get; } - - /// - /// Stores any notification message from export / import methods. - /// - string NotificationText { get; set; } - - /// - /// Convert all text items and localized strings to an easy to edit CSV format. - /// - string GetCSVData(); - - /// - /// Scan a localization CSV file and copies the strings for the specified language code - /// into the text properties of the appropriate scene objects. - /// - void SetActiveLanguage(string languageCode, bool forceUpdateSceneText = false); - - /// - /// Populates the text property of a single scene object with a new text value. - /// - bool PopulateTextProperty(string stringId, string newText); - - /// - /// Returns all standard text for localizeable text in the scene using an - /// easy to edit custom text format. - /// - string GetStandardText(); - - /// - /// Sets standard text on scene objects by parsing a text data file. - /// - void SetStandardText(string textData); - } - - /// - /// An item of localizeable text. - /// - public interface ILocalizable - { - /// - /// Gets the standard (non-localized) text. - /// - string GetStandardText(); - - /// - /// Sets the standard (non-localized) text. - /// - /// Standard text. - void SetStandardText(string standardText); - - /// - /// Gets the description used to help localizers. - /// - /// The description. - string GetDescription(); - - /// - /// Gets the unique string identifier. - /// - string GetStringId(); - } -}