Browse Source

Fixed choose English as language in localisation example #100

master
chrisgregan 10 years ago
parent
commit
725146a1aa
  1. 2
      Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs
  2. 8
      Assets/Fungus/Narrative/Scripts/Localization.cs

2
Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs

@ -17,7 +17,7 @@ namespace Fungus
Localization localization = GameObject.FindObjectOfType<Localization>(); Localization localization = GameObject.FindObjectOfType<Localization>();
if (localization != null) if (localization != null)
{ {
localization.SetActiveLanguage(languageCode); localization.SetActiveLanguage(languageCode, true);
} }
Continue(); Continue();

8
Assets/Fungus/Narrative/Scripts/Localization.cs

@ -297,7 +297,7 @@ namespace Fungus
* Scan a localization CSV file and copies the strings for the specified language code * Scan a localization CSV file and copies the strings for the specified language code
* into the text properties of the appropriate scene objects. * into the text properties of the appropriate scene objects.
*/ */
public virtual void SetActiveLanguage(string languageCode) public virtual void SetActiveLanguage(string languageCode, bool forceUpdateSceneText = false)
{ {
if (!Application.isPlaying) if (!Application.isPlaying)
{ {
@ -357,8 +357,14 @@ namespace Fungus
localizedStrings[fields[0]] = fields[languageIndex]; localizedStrings[fields[0]] = fields[languageIndex];
} }
// Early out unless we've been told to force the scene text to update.
// This happens when the Set Language command is used to reset back to the standard language.
if (!forceUpdateSceneText)
{
return; return;
} }
}
// Using a localized language text column // Using a localized language text column
// 1. Add all localized text to the localized strings dict // 1. Add all localized text to the localized strings dict

Loading…
Cancel
Save