Sayonara Player
Language.h
1 /* Language.h */
2 
3 /* Copyright (C) 2011-2017 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 
29 class LanguageString : public QString
30 {
31 public:
32  LanguageString(const QString& str);
33  LanguageString toFirstUpper() const;
34  LanguageString space() const;
35  LanguageString question() const;
36  LanguageString triplePt() const;
37 };
38 
39 class Lang :
40  public QObject
41 {
42  Q_OBJECT
43 
44 public:
45  enum Term
46  {
47  About=0,
48  Action,
49  Actions,
50  Activate,
51  Active,
52  AddTab,
53  Album,
54  AlbumArtists,
55  Albums,
56  All,
57  Append,
59  Apply,
60  Artist,
61  Artists,
62  Ascending,
63  Automatic,
64  Bitrate,
65  Bookmarks,
66  Broadcast,
67  By,
68  Cancel,
69  CannotFindLame,
70  Continue,
71  Covers,
72  Clear,
73  Close,
74  CloseOthers,
75  CloseTab,
76  DarkMode,
77  Date,
78  Days,
79  DaysShort,
80  Default,
81  Delete,
82  Descending,
83  Directory,
84  Directories,
85  Disc,
86  Duration,
87  DurationShort,
88  DynamicPlayback,
89  Edit,
90  EmptyInput,
91  EnterName,
92  EnterUrl,
93  Entries,
94  Entry,
95  Error,
96  Fast,
97  File,
98  Filename,
99  Files,
100  Filesize,
101  First,
102  Font,
103  Fonts,
104  Fulltext,
105  GaplessPlayback,
106  Genre,
107  Genres,
108  Hours,
109  HoursShort,
110  ImportDir,
111  ImportFiles,
112  Inactive,
113  Info,
114  InvalidChars,
115  Key_Find,
116  Key_Delete,
117  Key_Escape,
118  Key_Control,
119  Key_Alt,
120  Key_Shift,
121  Key_Backspace,
122  Key_Tab,
123  Library,
124  LibraryPath,
125  Listen,
126  Loading,
127  LoadingArg,
128  Logger,
129  Lyrics,
130  Menu,
131  Minimize,
132  Minutes,
133  MinutesShort,
134  Missing,
135  Months,
136  MoveDown,
137  MoveUp,
138  MuteOn,
139  MuteOff,
140  Name,
141  New,
142  NextTrack,
143  No,
144  None,
145  NumTracks,
146  OK,
147  On,
148  Open,
149  OpenDir,
150  OpenFile,
151  Or,
152  Overwrite,
153  Pause,
154  Play,
155  PlayingTime,
156  PlayInNewTab,
157  Playlist,
158  Playlists,
159  PlayNext,
160  PlayPause,
161  Plugin,
162  Podcasts,
163  Preferences,
164  PreviousTrack,
165  Quit,
166  Radio,
167  RadioStation,
168  Rating,
169  Really,
170  Refresh,
171  ReloadLibrary,
172  Remove,
173  Rename,
174  Repeat1,
175  RepeatAll,
176  Replace,
177  Reset,
178  Retry,
179  Sampler,
180  Save,
181  SaveAs,
182  SaveToFile,
183  SearchNoun,
184  SearchVerb,
185  SearchNext,
186  Second,
187  Seconds,
188  SecondsShort,
189  SeekForward,
190  SeekBackward,
191  Show,
192  ShowAlbumArtists,
193  ShowCovers,
194  ShowLibrary,
195  Shuffle,
196  Shutdown,
198  SortBy,
199  Stop,
200  Streams,
201  StreamUrl,
202  Success,
203  Th,
204  Third,
205  Title,
206  Track,
207  TrackOn,
208  TrackNo,
209  Tracks,
210  Tree,
211  Undo,
212  UnknownPlaceholder,
213  Various,
214  VariousAlbums,
215  VariousArtists,
216  VariousTracks,
217  Version,
218  VolumeDown,
219  VolumeUp,
220  Warning,
221  Weeks,
222  Year,
223  Years,
224  Yes,
225  Zoom,
226  NUMBER_OF_LANGUAGE_KEYS
227  };
228 
229 public:
230  Lang();
231  ~Lang();
232 
233  static LanguageString get(Lang::Term term, bool* ok=nullptr);
234 
235 
236  /*
237  * Eg: sayonara_lang_de.qm -> sayonara_lang_de_DE.qm
238  */
239  static QString convert_old_lang(const QString& old_lang);
240  static QMap<QString, QLocale> available_languages();
241 
242  static QString two_letter(const QString& language_name);
243  static QString four_letter(const QString& language_name);
244 };
245 
246 #endif // LANGUAGE_H
The Logger class.
Definition: Logger.h:59
Definition: Language.h:29
Definition: Lyrics.h:34
Definition: Application.h:30
Definition: GUI_PreferenceDialog.h:29
Definition: SimilarArtists.h:30
Definition: Language.h:39
Definition: Genre.h:29
The Album class.
Definition: Album.h:38
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31
The Artist class.
Definition: Artist.h:35
The Bookmarks logic class.
Definition: Bookmarks.h:36
Definition: AbstractPlaylist.h:44
Definition: org_mpris_media_player2_adaptor.h:21