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