| @@ -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() | LocalisedStrings::~LocalisedStrings() | ||||
| @@ -60,7 +60,7 @@ namespace | |||||
| { | { | ||||
| LeakAvoidanceTrick() | LeakAvoidanceTrick() | ||||
| { | { | ||||
| const ScopedPointer<LocalisedStrings> dummy (new LocalisedStrings (String())); | |||||
| const ScopedPointer<LocalisedStrings> 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; | StringArray lines; | ||||
| lines.addLines (fileContents); | 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) | void LocalisedStrings::setCurrentMappings (LocalisedStrings* newTranslations) | ||||
| { | { | ||||
| @@ -81,14 +81,16 @@ public: | |||||
| When you create one of these, you can call setCurrentMappings() to make it | When you create one of these, you can call setCurrentMappings() to make it | ||||
| the set of mappings that the system's using. | 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. | /** Creates a set of translations from a file. | ||||
| When you create one of these, you can call setCurrentMappings() to make it | When you create one of these, you can call setCurrentMappings() to make it | ||||
| the set of mappings that the system's using. | the set of mappings that the system's using. | ||||
| */ | */ | ||||
| LocalisedStrings (const File& fileToLoad); | |||||
| LocalisedStrings (const File& fileToLoad, | |||||
| bool ignoreCaseOfKeys); | |||||
| /** Destructor. */ | /** Destructor. */ | ||||
| ~LocalisedStrings(); | ~LocalisedStrings(); | ||||
| @@ -167,19 +169,13 @@ public: | |||||
| const StringArray& getCountryCodes() const { return countryCodes; } | 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: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| String languageName; | String languageName; | ||||
| StringArray countryCodes; | StringArray countryCodes; | ||||
| StringPairArray translations; | StringPairArray translations; | ||||
| void loadFromText (const String& fileContents); | |||||
| void loadFromText (const String&, bool ignoreCase); | |||||
| JUCE_LEAK_DETECTOR (LocalisedStrings) | JUCE_LEAK_DETECTOR (LocalisedStrings) | ||||
| }; | }; | ||||