Sayonara Player
Language.h
1 /* Language.h */
2 
3 /* Copyright (C) 2011-2019 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& str);
37 
42 
46  LanguageString space() const;
47 
51  LanguageString question() const;
52 
56  LanguageString triplePt() const;
57 
58  LanguageString& operator=(const LanguageString& other);
59 };
60 
65 class Lang :
66  public QObject
67 {
68  Q_OBJECT
69 
70 public:
71 
76  enum Term
77  {
78  About=0,
79  Action,
80  Actions,
81  Activate,
82  Active,
83  Add,
84  AddTab,
85  Album,
86  AlbumArtists,
87  Albums,
88  All,
89  Append,
91  Apply,
92  Artist,
93  Artists,
94  Ascending,
95  Automatic,
96  Bitrate,
97  Bookmarks,
98  Broadcast,
99  By,
100  Cancel,
101  CannotFindLame,
102  Comment,
103  Continue,
104  Covers,
105  Clear,
106  Close,
107  CloseOthers,
108  CloseTab,
109  CreateNewLibrary,
110  DarkMode,
111  Date,
112  Days,
113  DaysShort,
114  Default,
115  Delete,
116  Descending,
117  Directory,
118  Directories,
119  Disc,
120  Duration,
121  DurationShort,
122  DynamicPlayback,
123  Edit,
124  EmptyInput,
125  EnterName,
126  EnterUrl,
127  Entries,
128  Entry,
129  Error,
130  Fast,
131  File,
132  Filename,
133  Files,
134  Filesize,
135  Filetype,
136  Filter,
137  First,
138  Font,
139  Fonts,
140  Fulltext,
141  GaplessPlayback,
142  Genre,
143  Genres,
144  Hide,
145  Hours,
146  HoursShort,
147  ImportDir,
148  ImportFiles,
149  Inactive,
150  Info,
151  InvalidChars,
152  Key_Find,
153  Key_Delete,
154  Key_Escape,
155  Key_Control,
156  Key_Alt,
157  Key_Shift,
158  Key_Backspace,
159  Key_Tab,
160  Library,
161  LibraryPath,
162  Listen,
163  LiveSearch,
164  Loading,
165  LoadingArg,
166  Logger,
167  Lyrics,
168  Menu,
169  Minimize,
170  Minutes,
171  MinutesShort,
172  Missing,
173  Months,
174  MoveDown,
175  MoveUp,
176  MuteOn,
177  MuteOff,
178  Name,
179  New,
180  NextPage,
181  NextTrack,
182  No,
183  NoAlbums,
184  NumTracks,
185  OK,
186  On,
187  Open,
188  OpenDir,
189  OpenFile,
190  Or,
191  Overwrite,
192  Pause,
193  Play,
194  PlayingTime,
195  PlayInNewTab,
196  Playlist,
197  Playlists,
198  PlayNext,
199  PlayPause,
200  Plugin,
201  Podcasts,
202  Preferences,
203  PreviousPage,
204  PreviousTrack,
205  Quit,
206  Radio,
207  RadioStation,
208  Rating,
209  Really,
210  Refresh,
211  ReloadLibrary,
212  Remove,
213  Rename,
214  Repeat1,
215  RepeatAll,
216  Replace,
217  Reset,
218  Retry,
219  Sampler,
220  Save,
221  SaveAs,
222  SaveToFile,
223  SearchNoun,
224  SearchVerb,
225  SearchNext,
226  SearchPrev,
227  Second,
228  Seconds,
229  SecondsShort,
230  SeekForward,
231  SeekBackward,
232  Show,
233  ShowAlbumArtists,
234  ShowCovers,
235  ShowLibrary,
236  Shuffle,
237  Shutdown,
238  SimilarArtists,
239  SortBy,
240  Stop,
241  Streams,
242  StreamUrl,
243  Success,
244  Th,
245  Third,
246  Title,
247  Track,
248  TrackOn,
249  TrackNo,
250  Tracks,
251  Tree,
252  Undo,
253  UnknownAlbum,
254  UnknownArtist,
255  UnknownTitle,
256  UnknownGenre,
257  UnknownYear,
258  UnknownPlaceholder,
259  Various,
260  VariousAlbums,
261  VariousArtists,
262  VariousTracks,
263  Version,
264  VolumeDown,
265  VolumeUp,
266  Warning,
267  Weeks,
268  Year,
269  Years,
270  Yes,
271  Zoom,
272  NUMBER_OF_LANGUAGE_KEYS
273  };
274 
275 public:
276  Lang();
277  ~Lang();
278 
285  static LanguageString get(Lang::Term term, bool* ok=nullptr);
286 
292  static QString convert_old_lang(const QString& old_lang);
293 
294 
301 
307  static QString two_letter(const QString& language_name);
308 
314  static QString four_letter(const QString& language_name);
315 };
316 
317 #endif // LANGUAGE_H
The Logger class.
Definition: Logger.h:60
The LanguageString class.
Definition: Language.h:33
static QMap< QString, QLocale > available_languages()
Returns all languages located in user path and all languages in sayonara path.
static QString two_letter(const QString &language_name)
Returns the two letter representation of a language.
LanguageString space() const
appends a space
LanguageString triplePt() const
Appends triple points.
Definition: Application.h:30
Definition: RadioStation.h:37
Term
An enum for the most common translation files. use with Lang::get()
Definition: Language.h:76
The Lang class.
Definition: Language.h:65
static QString convert_old_lang(const QString &old_lang)
Converts two letter into four letter.
Definition: Genre.h:30
The Album class.
Definition: Album.h:39
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
The Artist class.
Definition: Artist.h:36
LanguageString question() const
appends question mark
static LanguageString get(Lang::Term term, bool *ok=nullptr)
Fetch translation by enum.
LanguageString toFirstUpper() const
Convert first character to upper case and rest to lower case.
static QString four_letter(const QString &language_name)
Returns the four letter representation of a language.
The Bookmarks logic class.
Definition: Bookmarks.h:36
Definition: org_mpris_media_player2_adaptor.h:21