Sayonara Player
Language.h
1 /* Language.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LANGUAGE_H
22 #define LANGUAGE_H
23 
24 #include <QObject>
25 #include <QList>
26 #include <QMap>
27 #include <QLocale>
28 
33 class LanguageString : public QString
34 {
35 public:
36  LanguageString(const QString& other);
37  LanguageString(const LanguageString& other) = default;
38 
39  LanguageString& operator=(const QString& other);
40  LanguageString& operator=(const LanguageString& other) = default;
41 
46 
51 
56 
61 };
62 
67 class Lang :
68  public QObject
69 {
70  Q_OBJECT
71 
72 public:
73 
78  enum Term
79  {
80  About=0,
81  Action,
82  Actions,
83  Activate,
84  Active,
85  Add,
86  AddArtist,
87  AddTab,
88  Album,
89  AlbumArtist,
90  AlbumArtists,
91  Albums,
92  All,
93  Append,
95  Apply,
96  Artist,
97  Artists,
98  Ascending,
99  Automatic,
100  Bitrate,
101  Bookmarks,
102  Broadcast,
103  By,
104  Cancel,
105  CannotFindLame,
106  Comment,
107  Continue,
108  Covers,
109  Clear,
110  ClearSelection,
111  Close,
112  CloseOthers,
113  CloseTab,
114  CreateDirectory,
115  Created,
116  CreateNewLibrary,
117  DarkMode,
118  Date,
119  Days,
120  DaysShort,
121  Default,
122  Delete,
123  Descending,
124  Directory,
125  Directories,
126  Disc,
127  Duration,
128  DurationShort,
129  DynamicPlayback,
130  Edit,
131  EmptyInput,
132  EnterName,
133  EnterNewName,
134  EnterUrl,
135  Entries,
136  Entry,
137  Error,
138  Fast,
139  File,
140  Filename,
141  Files,
142  Filesize,
143  Filetype,
144  Filter,
145  First,
146  Font,
147  Fonts,
148  Fulltext,
149  GaplessPlayback,
150  GB,
151  Genre,
152  Genres,
153  Hide,
154  Hours,
155  HoursShort,
156  ImportDir,
157  ImportFiles,
158  Inactive,
159  Info,
160  InvalidChars,
161  KB,
162  Key_Find,
163  Key_Delete,
164  Key_Escape,
165  Key_Control,
166  Key_Alt,
167  Key_Shift,
168  Key_Backspace,
169  Key_Tab,
170  Library,
171  LibraryPath,
172  LibraryView,
173  Listen,
174  LiveSearch,
175  Loading,
176  LoadingArg,
177  Logger,
178  LogLevel,
179  Lyrics,
180  MB,
181  Menu,
182  Minimize,
183  Minutes,
184  MinutesShort,
185  Missing,
186  Modified,
187  Months,
188  MoveDown,
189  MoveUp,
190  MuteOn,
191  MuteOff,
192  Name,
193  New,
194  NextPage,
195  NextTrack,
196  No,
197  NoAlbums,
198  NumTracks,
199  OK,
200  On,
201  Open,
202  OpenDir,
203  OpenFile,
204  Or,
205  Overwrite,
206  Pause,
207  Play,
208  PlayingTime,
209  PlayInNewTab,
210  Playlist,
211  Playlists,
212  PlayNext,
213  PlayPause,
214  Plugin,
215  Podcasts,
216  Preferences,
217  PreviousPage,
218  PreviousTrack,
219  PurchaseUrl,
220  Quit,
221  Radio,
222  RadioStation,
223  Rating,
224  Really,
225  Refresh,
226  ReloadLibrary,
227  Remove,
228  Rename,
229  Repeat1,
230  RepeatAll,
231  Replace,
232  Reset,
233  Retry,
234  ReverseOrder,
235  Sampler,
236  Save,
237  SaveAs,
238  SaveToFile,
239  ScanForFiles,
240  SearchNoun,
241  SearchVerb,
242  SearchNext,
243  SearchPrev,
244  Second,
245  Seconds,
246  SecondsShort,
247  SeekForward,
248  SeekBackward,
249  Show,
250  ShowAlbumArtists,
251  ShowCovers,
252  ShowLibrary,
253  Shuffle,
254  Shutdown,
255  SimilarArtists,
256  SortBy,
257  Stop,
258  Streams,
259  StreamUrl,
260  Success,
261  Th,
262  Third,
263  Title,
264  Track,
265  TrackOn,
266  TrackNo,
267  Tracks,
268  Tree,
269  Undo,
270  UnknownAlbum,
271  UnknownArtist,
272  UnknownTitle,
273  UnknownGenre,
274  UnknownYear,
275  UnknownPlaceholder,
276  Various,
277  VariousAlbums,
278  VariousArtists,
279  VariousTracks,
280  Version,
281  VolumeDown,
282  VolumeUp,
283  Warning,
284  Weeks,
285  Year,
286  Years,
287  Yes,
288  Zoom,
289  NUMBER_OF_LANGUAGE_KEYS
290  };
291 
292  enum TermNr
293  {
294  NrDirectories=0,
295  NrFiles,
296  NrPlaylists,
297  NrTracks,
298  NrTracksFound,
299  NUMBER_OF_LANGUAGE_PARAM_KEYS
300  };
301 
302 public:
303  Lang();
304  ~Lang();
305 
312  static LanguageString get(Lang::Term term, bool* ok=nullptr);
313 
314  static LanguageString getWithNumber(Lang::TermNr term, int param, bool* ok=nullptr);
315 };
316 
317 #endif // LANGUAGE_H
The Album class.
Definition: Album.h:41
Definition: Application.h:32
The Artist class.
Definition: Artist.h:38
The Bookmarks logic class.
Definition: Bookmarks.h:39
Definition: Genre.h:31
The Lang class.
Definition: Language.h:69
Term
An enum for the most common translation files. use with Lang::get()
Definition: Language.h:79
static LanguageString get(Lang::Term term, bool *ok=nullptr)
Fetch translation by enum.
The LanguageString class.
Definition: Language.h:34
LanguageString & space()
appends a space
LanguageString & triplePt()
Appends triple points.
LanguageString & question()
appends question mark
LanguageString & toFirstUpper()
Convert first character to upper case and rest to lower case.
The Logger class.
Definition: Logger.h:62
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
Definition: RadioStation.h:36