OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_LocalisedStrings.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
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
23 namespace juce
24{
25
26//==============================================================================
71 class JUCE_API LocalisedStrings
72{
73 public:
74 //==============================================================================
80 LocalisedStrings (const String& fileContents, bool ignoreCaseOfKeys);
81
87 LocalisedStrings (const File& fileToLoad, bool ignoreCaseOfKeys);
88
89 LocalisedStrings (const LocalisedStrings&);
90 LocalisedStrings& operator= (const LocalisedStrings&);
91
93 ~LocalisedStrings() = default;
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
188 private:
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
juce::File
Definition juce_File.h:45
juce::LocalisedStrings
Definition juce_LocalisedStrings.h:72
juce::LocalisedStrings::getCountryCodes
const StringArray & getCountryCodes() const
Definition juce_LocalisedStrings.h:166
juce::LocalisedStrings::getMappings
const StringPairArray & getMappings() const
Definition juce_LocalisedStrings.h:169
juce::LocalisedStrings::~LocalisedStrings
~LocalisedStrings()=default
juce::LocalisedStrings::getLanguageName
String getLanguageName() const
Definition juce_LocalisedStrings.h:155
juce::StringArray
Definition juce_StringArray.h:35
juce::StringPairArray
Definition juce_StringPairArray.h:35
juce::String
Definition juce_String.h:53