diff --git a/modules/juce_core/text/juce_LocalisedStrings.cpp b/modules/juce_core/text/juce_LocalisedStrings.cpp index a42b1da461..20253a730d 100644 --- a/modules/juce_core/text/juce_LocalisedStrings.cpp +++ b/modules/juce_core/text/juce_LocalisedStrings.cpp @@ -23,14 +23,14 @@ ============================================================================== */ -LocalisedStrings::LocalisedStrings (const String& fileContents) +LocalisedStrings::LocalisedStrings (const String& fileContents, bool ignoreCase) { - loadFromText (fileContents); + loadFromText (fileContents, ignoreCase); } -LocalisedStrings::LocalisedStrings (const File& fileToLoad) +LocalisedStrings::LocalisedStrings (const File& fileToLoad, bool ignoreCase) { - loadFromText (fileToLoad.loadFileAsString()); + loadFromText (fileToLoad.loadFileAsString(), ignoreCase); } LocalisedStrings::~LocalisedStrings() @@ -60,7 +60,7 @@ namespace { LeakAvoidanceTrick() { - const ScopedPointer dummy (new LocalisedStrings (String())); + const ScopedPointer dummy (new LocalisedStrings (String(), false)); } }; @@ -99,8 +99,10 @@ namespace } } -void LocalisedStrings::loadFromText (const String& fileContents) +void LocalisedStrings::loadFromText (const String& fileContents, bool ignoreCase) { + translations.setIgnoresCase (ignoreCase); + StringArray lines; lines.addLines (fileContents); @@ -138,11 +140,6 @@ void LocalisedStrings::loadFromText (const String& fileContents) } } -void LocalisedStrings::setIgnoresCase (const bool shouldIgnoreCase) -{ - translations.setIgnoresCase (shouldIgnoreCase); -} - //============================================================================== void LocalisedStrings::setCurrentMappings (LocalisedStrings* newTranslations) { diff --git a/modules/juce_core/text/juce_LocalisedStrings.h b/modules/juce_core/text/juce_LocalisedStrings.h index 58f620476c..034743e8c9 100644 --- a/modules/juce_core/text/juce_LocalisedStrings.h +++ b/modules/juce_core/text/juce_LocalisedStrings.h @@ -81,14 +81,16 @@ public: When you create one of these, you can call setCurrentMappings() to make it the set of mappings that the system's using. */ - LocalisedStrings (const String& fileContents); + LocalisedStrings (const String& fileContents, + bool ignoreCaseOfKeys); /** Creates a set of translations from a file. When you create one of these, you can call setCurrentMappings() to make it the set of mappings that the system's using. */ - LocalisedStrings (const File& fileToLoad); + LocalisedStrings (const File& fileToLoad, + bool ignoreCaseOfKeys); /** Destructor. */ ~LocalisedStrings(); @@ -167,19 +169,13 @@ public: const StringArray& getCountryCodes() const { return countryCodes; } - //============================================================================== - /** Indicates whether to use a case-insensitive search when looking up a string. - This defaults to true. - */ - void setIgnoresCase (bool shouldIgnoreCase); - private: //============================================================================== String languageName; StringArray countryCodes; StringPairArray translations; - void loadFromText (const String& fileContents); + void loadFromText (const String&, bool ignoreCase); JUCE_LEAK_DETECTOR (LocalisedStrings) };