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  Filetype,
102  Filter,
103  First,
104  Font,
105  Fonts,
106  Fulltext,
107  GaplessPlayback,
108  Genre,
109  Genres,
110  Hours,
111  HoursShort,
112  ImportDir,
113  ImportFiles,
114  Inactive,
115  Info,
116  InvalidChars,
117  Key_Find,
118  Key_Delete,
119  Key_Escape,
120  Key_Control,
121  Key_Alt,
122  Key_Shift,
123  Key_Backspace,
124  Key_Tab,
125  Library,
126  LibraryPath,
127  Listen,
128  LiveSearch,
129  Loading,
130  LoadingArg,
131  Logger,
132  Lyrics,
133  Menu,
134  Minimize,
135  Minutes,
136  MinutesShort,
137  Missing,
138  Months,
139  MoveDown,
140  MoveUp,
141  MuteOn,
142  MuteOff,
143  Name,
144  New,
145  NextTrack,
146  No,
147  None,
148  NumTracks,
149  OK,
150  On,
151  Open,
152  OpenDir,
153  OpenFile,
154  Or,
155  Overwrite,
156  Pause,
157  Play,
158  PlayingTime,
159  PlayInNewTab,
160  Playlist,
161  Playlists,
162  PlayNext,
163  PlayPause,
164  Plugin,
165  Podcasts,
166  Preferences,
167  PreviousTrack,
168  Quit,
169  Radio,
170  RadioStation,
171  Rating,
172  Really,
173  Refresh,
174  ReloadLibrary,
175  Remove,
176  Rename,
177  Repeat1,
178  RepeatAll,
179  Replace,
180  Reset,
181  Retry,
182  Sampler,
183  Save,
184  SaveAs,
185  SaveToFile,
186  SearchNoun,
187  SearchVerb,
188  SearchNext,
189  Second,
190  Seconds,
191  SecondsShort,
192  SeekForward,
193  SeekBackward,
194  Show,
195  ShowAlbumArtists,
196  ShowCovers,
197  ShowLibrary,
198  Shuffle,
199  Shutdown,
201  SortBy,
202  Stop,
203  Streams,
204  StreamUrl,
205  Success,
206  Th,
207  Third,
208  Title,
209  Track,
210  TrackOn,
211  TrackNo,
212  Tracks,
213  Tree,
214  Undo,
215  UnknownPlaceholder,
216  Various,
217  VariousAlbums,
218  VariousArtists,
219  VariousTracks,
220  Version,
221  VolumeDown,
222  VolumeUp,
223  Warning,
224  Weeks,
225  Year,
226  Years,
227  Yes,
228  Zoom,
229  NUMBER_OF_LANGUAGE_KEYS
230  };
231 
232 public:
233  Lang();
234  ~Lang();
235 
236  static LanguageString get(Lang::Term term, bool* ok=nullptr);
237 
238 
239  /*
240  * Eg: sayonara_lang_de.qm -> sayonara_lang_de_DE.qm
241  */
242  static QString convert_old_lang(const QString& old_lang);
243  static QMap<QString, QLocale> available_languages();
244 
245  static QString two_letter(const QString& language_name);
246  static QString four_letter(const QString& language_name);
247 };
248 
249 #endif // LANGUAGE_H
The Logger class.
Definition: Logger.h:60
Definition: Language.h:29
Definition: Lyrics.h:30
Definition: Application.h:30
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:33
Definition: org_mpris_media_player2_adaptor.h:21