OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce_LocalisedStrings.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
71class JUCE_API LocalisedStrings
72{
73public:
74 //==============================================================================
80 LocalisedStrings (const String& fileContents, bool ignoreCaseOfKeys);
81
87 LocalisedStrings (const File& fileToLoad, bool ignoreCaseOfKeys);
88
91
94
95 //==============================================================================
106 static void setCurrentMappings (LocalisedStrings* newTranslations);
107
113 static LocalisedStrings* getCurrentMappings();
114
124 static String translateWithCurrentMappings (const String& text);
125
135 static String translateWithCurrentMappings (const char* text);
136
137 //==============================================================================
141 String translate (const String& text) const;
142
146 String translate (const String& text, const String& resultIfNotFound) const;
147
155 String getLanguageName() const { return languageName; }
156
166 const StringArray& getCountryCodes() const { return countryCodes; }
167
169 const StringPairArray& getMappings() const { return translations; }
170
171 //==============================================================================
180 void addStrings (const LocalisedStrings&);
181
186 void setFallback (LocalisedStrings* fallbackStrings);
187
188private:
189 //==============================================================================
190 String languageName;
191 StringArray countryCodes;
192 StringPairArray translations;
193 std::unique_ptr<LocalisedStrings> fallback;
194
195 void loadFromText (const String&, bool ignoreCase);
196
197 JUCE_LEAK_DETECTOR (LocalisedStrings)
198};
199
200//==============================================================================
201#ifndef TRANS
208 #define TRANS(stringLiteral) juce::translate (stringLiteral)
209#endif
210
218#define NEEDS_TRANS(stringLiteral) (stringLiteral)
219
223JUCE_API String translate (const String& stringLiteral);
224
228JUCE_API String translate (const char* stringLiteral);
229
233JUCE_API String translate (CharPointer_UTF8 stringLiteral);
234
238JUCE_API String translate (const String& stringLiteral, const String& resultIfNotFound);
239
240} // namespace juce
const StringArray & getCountryCodes() const
const StringPairArray & getMappings() const