openshot-audio  0.1.4
juce_LocalisedStrings.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_LOCALISEDSTRINGS_H_INCLUDED
30 #define JUCE_LOCALISEDSTRINGS_H_INCLUDED
31 
32 
33 //==============================================================================
77 {
78 public:
79  //==============================================================================
85  LocalisedStrings (const String& fileContents, bool ignoreCaseOfKeys);
86 
92  LocalisedStrings (const File& fileToLoad, bool ignoreCaseOfKeys);
93 
95  LocalisedStrings& operator= (const LocalisedStrings&);
96 
99 
100  //==============================================================================
111  static void setCurrentMappings (LocalisedStrings* newTranslations);
112 
118  static LocalisedStrings* getCurrentMappings();
119 
129  static String translateWithCurrentMappings (const String& text);
130 
140  static String translateWithCurrentMappings (const char* text);
141 
142  //==============================================================================
146  String translate (const String& text) const;
147 
151  String translate (const String& text, const String& resultIfNotFound) const;
152 
160  String getLanguageName() const { return languageName; }
161 
171  const StringArray& getCountryCodes() const { return countryCodes; }
172 
174  const StringPairArray& getMappings() const { return translations; }
175 
176  //==============================================================================
185  void addStrings (const LocalisedStrings&);
186 
191  void setFallback (LocalisedStrings* fallbackStrings);
192 
193 private:
194  //==============================================================================
195  String languageName;
196  StringArray countryCodes;
200 
201  void loadFromText (const String&, bool ignoreCase);
202 
204 };
205 
206 //==============================================================================
207 #ifndef TRANS
208 
214  #define TRANS(stringLiteral) juce::translate (stringLiteral)
215 #endif
216 
224 #define NEEDS_TRANS(stringLiteral) (stringLiteral)
225 
229 JUCE_API String translate (const String& stringLiteral);
230 
234 JUCE_API String translate (const char* stringLiteral);
235 
239 JUCE_API String translate (CharPointer_UTF8 stringLiteral);
240 
244 JUCE_API String translate (const String& stringLiteral, const String& resultIfNotFound);
245 
246 
247 #endif // JUCE_LOCALISEDSTRINGS_H_INCLUDED
String getLanguageName() const
Definition: juce_LocalisedStrings.h:160
Definition: juce_StringPairArray.h:39
JUCE_API String translate(const String &stringLiteral)
Definition: juce_LocalisedStrings.cpp:197
const StringPairArray & getMappings() const
Definition: juce_LocalisedStrings.h:174
Definition: juce_CharPointer_UTF8.h:38
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
const StringArray & getCountryCodes() const
Definition: juce_LocalisedStrings.h:171
Definition: juce_StringArray.h:39
Definition: juce_ContainerDeletePolicy.h:44
Definition: juce_LocalisedStrings.h:76
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
const KeyNameAndCode translations[]
Definition: juce_gui_basics.cpp:100
Definition: juce_File.h:45