1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2006 Chusslove Illich <caslav.ilic@gmx.net> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | #ifndef KLOCALIZEDSTRING_H |
20 | #define KLOCALIZEDSTRING_H |
21 | |
22 | #include <kdecore_export.h> |
23 | |
24 | |
25 | #include <QtCore/QChar> |
26 | #include <QtCore/QLatin1Char> |
27 | #include <QtCore/QStringList> |
28 | |
29 | class KLocale; |
30 | struct KCatalogName; |
31 | class KLocalizedStringPrivate; |
32 | |
33 | /** |
34 | * \file klocalizedstring.h |
35 | */ |
36 | |
37 | #ifndef I18N_NOOP |
38 | /** |
39 | * I18N_NOOP marks a string to be translated without translating it. |
40 | * Do not use this unless you know you need it. |
41 | * http://developer.kde.org/documentation/other/developer-faq.html#q2.11.2 |
42 | * |
43 | * Example usage where say_something() returns either "hello" or "goodbye": |
44 | * \code |
45 | * (void) I18N_NOOP("hello"); |
46 | * (void) I18N_NOOP("goodbye"); |
47 | * ... |
48 | * mystring = i18n(say_something()); |
49 | * \endcode |
50 | */ |
51 | #define I18N_NOOP(x) x |
52 | #endif |
53 | |
54 | #ifndef I18N_NOOP2 |
55 | /** |
56 | * If the string is too ambiguous to be translated well to a non-english |
57 | * language, use this instead of I18N_NOOP to separate lookup string and |
58 | * english. |
59 | * |
60 | * Example usage where say_something() returns either "hello" or "goodbye": |
61 | * \code |
62 | * (void) I18N_NOOP2("greeting", "hello"); |
63 | * (void) I18N_NOOP2("greeting", "goodbye"); |
64 | * ... |
65 | * mystring = i18nc("greeting", say_something()); |
66 | * \endcode |
67 | * \warning You need to call i18nc(context, stringVar) later on, not just |
68 | * i18n(stringVar). |
69 | * |
70 | * @see I18N_NOOP2_NOSTRIP |
71 | */ |
72 | #define I18N_NOOP2(comment,x) x |
73 | #endif |
74 | |
75 | #ifndef I18N_NOOP2_NOSTRIP |
76 | /** |
77 | * @since 4.3 |
78 | * |
79 | * Similar to I18N_NOOP2, except that neither of the two arguments is omitted. |
80 | * This is typically used when contexts need to differ between static entries, |
81 | * and only some of the entries need context: |
82 | * \code |
83 | * struct MyTextLabels |
84 | * { |
85 | * int labelId; |
86 | * const char *context; |
87 | * const char *text; |
88 | * }; |
89 | * const MyTextLabels labels[] = { |
90 | * { 10, I18N_NOOP2_NOSTRIP("new game", "New") }, |
91 | * { 20, 0, I18N_NOOP("End Turn") }, |
92 | * { 30, I18N_NOOP2_NOSTRIP("default move", "Default") }, |
93 | * { 40, 0, I18N_NOOP("Quit") }, |
94 | * ... |
95 | * }; |
96 | * ... |
97 | * QString itemLabel = i18nc(labels[item].context, labels[item].text); |
98 | * \endcode |
99 | * Note that i18nc() will not have any problems with context being null, |
100 | * it will simply behave as ordinary i18n(). |
101 | */ |
102 | #define I18N_NOOP2_NOSTRIP(ctxt, text) ctxt, text |
103 | #endif |
104 | |
105 | /** |
106 | * @short Class for producing and handling localized messages |
107 | * |
108 | * KLocalizedString handles translation and specific needs of argument |
109 | * substitution and formatting in localized message strings. |
110 | * |
111 | * Topics: |
112 | * - @ref gen_usage |
113 | * - @ref spec_usage |
114 | * - @ref subs_notes |
115 | * - @ref other_ref |
116 | * |
117 | * \section gen_usage General Usage |
118 | * |
119 | * This class should mostly not be used directly, but through wrapper i18n |
120 | * calls which return QString, for localization of user visible messages in |
121 | * applications. |
122 | * |
123 | * For the most frequent message type, the one without any arguments, you would |
124 | * use simply: |
125 | * \code |
126 | * QString msg = i18n("Just plain info"); |
127 | * \endcode |
128 | * |
129 | * If there are arguments to be substitued into the message, you just add them |
130 | * after the message string: |
131 | * \code |
132 | * QString msg = i18n("%1 has scored %2", playerName, score); |
133 | * \endcode |
134 | * There can be up to some final number of arguments added like this (i18n |
135 | * is realized by overloaded templates). If you overrun this number, use |
136 | * ki18n* series of calls (described below). You can use several types as |
137 | * arguments, see subs methods. |
138 | * |
139 | * Sometimes a short message can be ambiguous in English, then you would use |
140 | * the context version, i18nc. There the first string is context, and the |
141 | * second is the message which really gets displayed: |
142 | * \code |
143 | * QString msg = i18nc("Player name - score", "%1 - %2", playerName, score); |
144 | * \endcode |
145 | * |
146 | * While English diferentiates plural forms only between 1 and else, in other |
147 | * languages it might not be that simple, or it might be simpler. To handle |
148 | * this properly, use plural call, i18np: |
149 | * \code |
150 | * QString msg = i18np("One image in album %2", "%1 images in album %2", |
151 | * numImages, albumName); |
152 | * \endcode |
153 | * Note that the plural form shall be decided by first integer-valued argument, |
154 | * (numImages in the example above). In rare cases when there are two integer |
155 | * arguments, you should take care to order them properly. |
156 | * |
157 | * Finally, message might need both context and plural, which is provided by |
158 | * i18ncp call: |
159 | * \code |
160 | * QString msg = i18ncp("Personal file", "One file", "%1 files", numFiles); |
161 | * \endcode |
162 | * |
163 | * Be carefull not to use literal string as first argument after message text |
164 | * in basic i18n() call. In debug mode, it will even trigger the static assert, |
165 | * giving error at compile time. This is in order to prevent misnamed calls: |
166 | * it may happen that you add context or plural to previously basic message, |
167 | * but forget to change the name of the call. |
168 | * |
169 | * All message strings are expected to pass for well-formed XML, whether or |
170 | * not the output device supports some form of markup. |
171 | * Thus, predefined XML entities are always available: &lt;, &gt;, |
172 | * &amp;, &apos;, and &quot;. E.g. if you need a non-tag |
173 | * less-than sign, use &lt; entity instead. |
174 | * The exception to the well-formed XML requirement is the ampersand (&), |
175 | * which is used a lot for marking accelerators, so you should not write it |
176 | * as &amp; (except in the very unlikely case when the construct with |
177 | * the naked ampersand can be interpreted as an entity in itself). |
178 | * |
179 | * \section spec_usage Specialized Usage |
180 | * |
181 | * There are some situations where i18n* calls are not sufficient or |
182 | * convenient. For one, if you need to substitute many arguments. Or, if you |
183 | * find that you need to defer the substitution. For this you can use the |
184 | * ki18n call which returns a KLocalizedString, substitute arguments |
185 | * using its subs methods, and finalize the translation by calling |
186 | * its toString method. For example: |
187 | * \code |
188 | * KLocalizedString ks; |
189 | * case (reportSource) { |
190 | * SRC_ENG: ks = ki18n("Engineering reports: %1"); break; |
191 | * SRC_HEL: ks = ki18n("Helm reports: %1"); break; |
192 | * SRC_SON: ks = ki18n("Sonar reports: %1"); break; |
193 | * default: ks = ki18n("General report: %1"); |
194 | * } |
195 | * QString msg = ks.subs(reportText).toString(); |
196 | * \endcode |
197 | * |
198 | * Another case is when you want extra formatting of arguments, like field |
199 | * width or number of decimals. subs methods can take these formatting |
200 | * parameters. In particular, you should @e never use some custom way to |
201 | * format arguments, as subs methods will also properly localize them: |
202 | * \code |
203 | * QString s = i18n("Rounds: %1", myNumberFormat(n, 8)); // bad, number not localized |
204 | * QString s = ki18n("Rounds: %1").subs(n, 8).toString(); // good, number localized |
205 | * \endcode |
206 | * |
207 | * There are also context, plural and context-plural variants: |
208 | * \code |
209 | * QString s = ki18nc("No function", "None").toString(); |
210 | * QString s = ki18np("File found", "%1 files found").subs(n).toString(); |
211 | * QString s = ki18ncp("Personal file", "One file", "%1 files").subs(n).toString(); |
212 | * \endcode |
213 | * |
214 | * If you need translation using locale (ie. KLocale object) other than the |
215 | * default, you can use overloaded toString method which takes pointer to a |
216 | * locale: |
217 | * \code |
218 | * KLocale *myLocale; |
219 | * ... |
220 | * QString msg = ki18n("Welcome").toString(myLocale); |
221 | * \endcode |
222 | * |
223 | * Normally all loaded catalogs are searched for translation, |
224 | * and the first found translation is returned. |
225 | * Sometimes this may lead to clashes, especially when dealing with |
226 | * specialized collection catalogs (country names, language names, etc.) |
227 | * in which messages are not equipped with contexts. |
228 | * In such situations, toString method can take the name of |
229 | * the specific catalog in which to look for translation: |
230 | * \code |
231 | * QString trName = ki18n("Georgia").toString("countries"); |
232 | * \endcode |
233 | * |
234 | * Translators have a capability to script translations at runtime, which is |
235 | * for the most part transparent to the programmer. However, sometimes the |
236 | * programmer may help by providing some @e dynamic context to the message, |
237 | * using the inContext method of KLocalizedString. Unlike the ordinary |
238 | * context, this one changes at runtime; translators have the means to fetch |
239 | * it and use it to script the translation properly. An example: |
240 | * \code |
241 | * KLocalizedString ks = ki18nc("%1 is user name; may have " |
242 | * "dynamic context gender=[male,female]", |
243 | * "%1 went offline"); |
244 | * if (knownUsers.contains(user) && !knownUsers[user].gender.isEmpty()) { |
245 | * ks = ks.inContext("gender", knownUsers[user].gender); |
246 | * } |
247 | * QString msg = ks.subs(user).toString(); |
248 | * \endcode |
249 | * Several dynamic contexts, with different keys, can be added like this. |
250 | * |
251 | * \section subs_notes Placeholder Substitution |
252 | * |
253 | * Hopefully, for the most part placeholders are being substituted the way |
254 | * you would intuitively expect them to be. Nevertheless: |
255 | * |
256 | * \li Placeholders are substituted in one pass, so no need to worry about |
257 | * argument itself containing a placeholder. |
258 | * |
259 | * \li All same-numbered placeholders are substituted with same argument. |
260 | * |
261 | * \li Placeholders directly index arguments: they should be numbered from 1 |
262 | * upwards, without gaps in the sequence so that each argument is indexed. |
263 | * Otherwise you will get error marks in messages at runtime (when compiled |
264 | * in debug mode), and any invalid placeholder will be left unsubstituted. |
265 | * The exception is plural-deciding argument in plural call, where it is |
266 | * allowed to drop its placeholder in either singular or plural form. |
267 | * |
268 | * \li If none of the arguments supplied to a plural call is integer-valued, |
269 | * you will get an error mark in message at runtime (in debug mode). |
270 | * |
271 | * \li Plain number arguments will be normally formatted as if they denote |
272 | * amounts, according to language rules (thousands separation, etc.) |
273 | * But sometimes a number is a numerical identifier (e.g. port number), |
274 | * and to be treated as such, wrap the placeholder with the numid tag: |
275 | * \code |
276 | * QString msg = i18n("Using port <numid>%1</numid>", port); |
277 | * \endcode |
278 | * |
279 | * \section other_ref Further References |
280 | * |
281 | * <a href="http://techbase.kde.org/">KDE Techbase</a> contains a |
282 | * <a href="http://techbase.kde.org/Development/Tutorials/Localization"> |
283 | * series of tutorials</a> on preparing the code for localization (and on |
284 | * internationalization process in general), where the intended patterns of |
285 | * usage of i18n API are covered in great detail. |
286 | * |
287 | * All i18n'd messages, whether sent to widgets expecting plain text or |
288 | * allowing Qt rich text (HTML), support the new KDE semantic markup for |
289 | * user interface text, KUIT in short. Semantic markup both increases the |
290 | * consistency of visual presentation for the end user, and provides extra |
291 | * information to translators, so that translations can be of higher quality. |
292 | * KUIT is documented in an |
293 | * <a href="http://techbase.kde.org/Development/Tutorials/Localization/i18n_Semantics"> |
294 | * Techbase article</a> as well. |
295 | * |
296 | * @see KLocale |
297 | * @author Chusslove Illich \<caslav.ilic@gmx.net\> |
298 | */ |
299 | class KDECORE_EXPORT KLocalizedString |
300 | { |
301 | |
302 | friend KLocalizedString KDECORE_EXPORT ki18n (const char* msg); |
303 | friend KLocalizedString KDECORE_EXPORT ki18nc (const char *ctxt, const char *msg); |
304 | friend KLocalizedString KDECORE_EXPORT ki18np (const char *singular, const char *plural); |
305 | friend KLocalizedString KDECORE_EXPORT ki18ncp (const char *ctxt, |
306 | const char *singular, const char *plural); |
307 | |
308 | public: |
309 | /** |
310 | * Constructs an empty message, which is not valid for finalization. |
311 | * Useful when you later need to assign KLocalizedString obtained by one |
312 | * of ki18n* calls. |
313 | * |
314 | * @see isEmpty() |
315 | */ |
316 | explicit KLocalizedString (); |
317 | |
318 | /** |
319 | * Copy constructor. |
320 | */ |
321 | KLocalizedString (const KLocalizedString &rhs); |
322 | |
323 | /** |
324 | * Assignment operator. |
325 | */ |
326 | KLocalizedString& operator= (const KLocalizedString &rhs); |
327 | |
328 | /** |
329 | * Destructor. |
330 | */ |
331 | ~KLocalizedString (); |
332 | |
333 | /** |
334 | * Finalizes the translation, creates QString with placeholders |
335 | * substituted. Translation is obtained from default locale. |
336 | * |
337 | * If there was any mismatch between placeholders and arguments |
338 | * returned string will contain error marks (in debug mode). |
339 | * |
340 | * @return finalized translation |
341 | */ |
342 | QString toString () const; |
343 | |
344 | /** |
345 | * @since 4.5 |
346 | * |
347 | * Like toString, but looks for translation only in specific catalog. |
348 | * |
349 | * @param catalogName the name of the catalog to check for translation |
350 | * @return finalized translation |
351 | */ |
352 | QString toString (const QString &catalogName) const; |
353 | |
354 | /** |
355 | * Finalizes the translation, creates QString with placeholders |
356 | * substituted. Translation is obtained from given locale. If locale |
357 | * is NULL, original message is used instead of translated. |
358 | * |
359 | * If there was any mismatch between placeholders and arguments |
360 | * returned string will contain error marks (in debug mode). |
361 | * |
362 | * @param locale locale from which translations are to be taken |
363 | * @return finalized translation |
364 | */ |
365 | QString toString (const KLocale *locale) const; |
366 | |
367 | /** |
368 | * @since 4.5 |
369 | * |
370 | * Like toString, but looks for translation only in specific catalog. |
371 | * |
372 | * @param locale locale from which translations are to be taken |
373 | * @param catalogName the name of the catalog to check for translation |
374 | * @return finalized translation |
375 | */ |
376 | QString toString (const KLocale *locale, const QString &catalogName) const; |
377 | |
378 | /** |
379 | * Checks whether the message is empty. This will happen if you just |
380 | * constructed the object via default constructor. |
381 | * |
382 | * Empty messages are not valid for finalization; if you use toString() on |
383 | * them, you will get error mark instead of empty QString (in debug mode). |
384 | * |
385 | * @return @c true if the message is empty, else @c false |
386 | */ |
387 | bool isEmpty() const; |
388 | |
389 | /** |
390 | * Substitutes an int argument into the message. |
391 | * |
392 | * @param a the argument |
393 | * @param fieldWidth width of the formatted field, padded by spaces. |
394 | * Positive value aligns right, negative aligns left |
395 | * @param base the radix used to represent the number as a string. |
396 | * Valid values range from 2 to 36 |
397 | * @param fillChar the character used to fill up the empty places when |
398 | * field width is greater than argument width |
399 | * @return resultant KLocalizedString |
400 | */ |
401 | KLocalizedString subs (int a, int fieldWidth = 0, int base = 10, |
402 | const QChar &fillChar = QLatin1Char(' ')) const; |
403 | |
404 | /** |
405 | * Substitutes an unsigned int argument into the message. |
406 | * |
407 | * @param a the argument |
408 | * @param fieldWidth width of the formatted field, padded by spaces. |
409 | * Positive value aligns right, negative aligns left |
410 | * @param base the radix used to represent the number as a string. |
411 | * Valid values range from 2 to 36 |
412 | * @param fillChar the character used to fill up the empty places when |
413 | * field width is greater than argument width |
414 | * @return resultant KLocalizedString |
415 | */ |
416 | KLocalizedString subs (uint a, int fieldWidth = 0, int base = 10, |
417 | const QChar &fillChar = QLatin1Char(' ')) const; |
418 | |
419 | /** |
420 | * Substitutes a long argument into the message. |
421 | * |
422 | * @param a the argument |
423 | * @param fieldWidth width of the formatted field, padded by spaces. |
424 | * Positive value aligns right, negative aligns left |
425 | * @param base the radix used to represent the number as a string. |
426 | * Valid values range from 2 to 36 |
427 | * @param fillChar the character used to fill up the empty places when |
428 | * field width is greater than argument width |
429 | * @return resultant KLocalizedString |
430 | */ |
431 | KLocalizedString subs (long a, int fieldWidth = 0, int base = 10, |
432 | const QChar &fillChar = QLatin1Char(' ')) const; |
433 | |
434 | /** |
435 | * Substitutes an unsigned long argument into the message. |
436 | * |
437 | * @param a the argument |
438 | * @param fieldWidth width of the formatted field, padded by spaces. |
439 | * Positive value aligns right, negative aligns left |
440 | * @param base the radix used to represent the number as a string. |
441 | * Valid values range from 2 to 36 |
442 | * @param fillChar the character used to fill up the empty places when |
443 | * field width is greater than argument width |
444 | * @return resultant KLocalizedString |
445 | */ |
446 | KLocalizedString subs (ulong a, int fieldWidth = 0, int base = 10, |
447 | const QChar &fillChar = QLatin1Char(' ')) const; |
448 | |
449 | /** |
450 | * Substitutes a long long argument into the message. |
451 | * |
452 | * @param a the argument |
453 | * @param fieldWidth width of the formatted field, padded by spaces. |
454 | * Positive value aligns right, negative aligns left |
455 | * @param base the radix used to represent the number as a string. |
456 | * Valid values range from 2 to 36 |
457 | * @param fillChar the character used to fill up the empty places when |
458 | * field width is greater than argument width |
459 | * @return resultant KLocalizedString |
460 | */ |
461 | KLocalizedString subs (qlonglong a, int fieldWidth = 0, int base = 10, |
462 | const QChar &fillChar = QLatin1Char(' ')) const; |
463 | |
464 | /** |
465 | * Substitutes an unsigned long long argument into the message. |
466 | * |
467 | * @param a the argument |
468 | * @param fieldWidth width of the formatted field, padded by spaces. |
469 | * Positive value aligns right, negative aligns left |
470 | * @param base the radix used to represent the number as a string. |
471 | * Valid values range from 2 to 36 |
472 | * @param fillChar the character used to fill up the empty places when |
473 | * field width is greater than argument width |
474 | * @return resultant KLocalizedString |
475 | */ |
476 | KLocalizedString subs (qulonglong a, int fieldWidth = 0, int base = 10, |
477 | const QChar &fillChar = QLatin1Char(' ')) const; |
478 | |
479 | /** |
480 | * Substitutes a double argument into the message. |
481 | * |
482 | * @param a the argument |
483 | * @param fieldWidth width of the formatted field, padded by spaces. |
484 | * Positive value aligns right, negative aligns left |
485 | * @param format type of floating point formating, like in QString::arg |
486 | * @param precision number of digits after the decimal separator |
487 | * @param fillChar the character used to fill up the empty places when |
488 | * field width is greater than argument width |
489 | * @return resultant KLocalizedString |
490 | */ |
491 | KLocalizedString subs (double a, int fieldWidth = 0, |
492 | char format = 'g', int precision = -1, |
493 | const QChar &fillChar = QLatin1Char(' ')) const; |
494 | |
495 | /** |
496 | * Substitutes a QChar argument into the message. |
497 | * |
498 | * @param a the argument |
499 | * @param fieldWidth width of the formatted field, padded by spaces. |
500 | * Positive value aligns right, negative aligns left |
501 | * @param fillChar the character used to fill up the empty places when |
502 | * field width is greater than argument width |
503 | * @return resultant KLocalizedString |
504 | */ |
505 | KLocalizedString subs (QChar a, int fieldWidth = 0, |
506 | const QChar &fillChar = QLatin1Char(' ')) const; |
507 | |
508 | /** |
509 | * Substitutes a QString argument into the message. |
510 | * |
511 | * @param a the argument |
512 | * @param fieldWidth width of the formatted field, padded by spaces. |
513 | * Positive value aligns right, negative aligns left |
514 | * @param fillChar the character used to fill up the empty places when |
515 | * field width is greater than argument width |
516 | * @return resultant KLocalizedString |
517 | */ |
518 | KLocalizedString subs (const QString &a, int fieldWidth = 0, |
519 | const QChar &fillChar = QLatin1Char(' ')) const; |
520 | |
521 | /** |
522 | * Adds dynamic context to the message. |
523 | * |
524 | * @param key context key |
525 | * @param text context value |
526 | * @return resultant KLocalizedString |
527 | */ |
528 | KLocalizedString inContext (const QString &key, |
529 | const QString &text) const; |
530 | |
531 | /** |
532 | * @internal Called from KLocale on addition or removal of catalogs. |
533 | */ |
534 | static void notifyCatalogsUpdated (const QStringList &languages, |
535 | const QList<KCatalogName> &catalogs); |
536 | |
537 | private: |
538 | KLocalizedString (const char *ctxt, |
539 | const char *msg, const char *plural); |
540 | |
541 | KLocalizedStringPrivate * const d; |
542 | }; |
543 | |
544 | /** |
545 | * Creates localized string from a given message. |
546 | * Normaly you should use i18n() templates instead, as you need real |
547 | * KLocalizedString object only in special cases. |
548 | * All text arguments must be UTF-8 encoded and must not be empty or NULL. |
549 | * |
550 | * @param msg message text |
551 | * @return created KLocalizedString |
552 | */ |
553 | extern KLocalizedString KDECORE_EXPORT ki18n (const char* msg); |
554 | |
555 | /** |
556 | * Creates localized string from a given message, with added context. |
557 | * Context is only for disambiguation purposes (both for lookup and |
558 | * for translators), it is not part of the message. |
559 | * Normaly you should use i18nc() templates instead, as you need real |
560 | * KLocalizedString object only in special cases. |
561 | * All text arguments must be UTF-8 encoded and must not be empty or NULL. |
562 | * |
563 | * @param ctxt context text |
564 | * @param msg message text |
565 | * @return created KLocalizedString |
566 | */ |
567 | extern KLocalizedString KDECORE_EXPORT ki18nc (const char *ctxt, const char *msg); |
568 | |
569 | /** |
570 | * Creates localized string from a given plural and singular form. |
571 | * Normaly you should use i18np() templates instead, as you need real |
572 | * KLocalizedString object only in special cases. |
573 | * All text arguments must be UTF-8 encoded and must not be empty or NULL. |
574 | * |
575 | * @param singular message text in singular |
576 | * @param plural message text in plural |
577 | * @return created KLocalizedString |
578 | */ |
579 | extern KLocalizedString KDECORE_EXPORT ki18np (const char *singular, const char *plural); |
580 | |
581 | /** |
582 | * Creates localized string from a given plural and singular form, |
583 | * with added context. |
584 | * Context is only for disambiguation purposes (both for lookup and |
585 | * for translators), it is not part of the message. |
586 | * Normaly you should use i18ncp() templates instead, as you need real |
587 | * KLocalizedString object only in special cases. |
588 | * All text arguments must be UTF-8 encoded and must not be empty or NULL. |
589 | * |
590 | * @param ctxt context text |
591 | * @param singular message text in singular |
592 | * @param plural message text in plural |
593 | * @return created KLocalizedString |
594 | */ |
595 | extern KLocalizedString KDECORE_EXPORT ki18ncp (const char *ctxt, const char *singular, const char *plural); |
596 | |
597 | /** |
598 | * Qt's uic generated translation calls go through numerous indirections |
599 | * unnecessary in our case. So we use uic -tr tr2i18n to redirect them |
600 | * to our i18n API. |
601 | **/ |
602 | inline QString tr2i18n (const char *message, const char * = 0) { |
603 | if (comment && comment[0] && message && message[0]) { |
604 | return ki18nc(comment, message).toString(); |
605 | } |
606 | else if (message && message[0]) { |
607 | return ki18n(message).toString(); |
608 | } |
609 | else { |
610 | return QString(); |
611 | } |
612 | } |
613 | |
614 | #ifndef NDEBUG |
615 | #define I18N_ERR_MSG String_literal_as_second_argument_to_i18n___Perhaps_you_need_i18nc_or_i18np |
616 | template <typename T, int s> class I18nTypeCheck {public: static void I18N_ERR_MSG () {}}; |
617 | template <int s> class I18nTypeCheck<char[s], s> {}; |
618 | #define STATIC_ASSERT_NOT_LITERAL_STRING(T) I18nTypeCheck<T, sizeof(T)>::I18N_ERR_MSG (); |
619 | #else |
620 | #define STATIC_ASSERT_NOT_LITERAL_STRING(T) |
621 | #endif |
622 | |
623 | // >>>>> Basic calls |
624 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
625 | /** |
626 | * Returns a localized version of a string. |
627 | * @param text string to be localized |
628 | * @return localized string |
629 | */ |
630 | inline QString i18n (const char *text) |
631 | { |
632 | return ki18n(text).toString(); |
633 | } |
634 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
635 | /** |
636 | * Returns a localized version of a string with 1 argument. |
637 | * @param text string to be localized |
638 | * @param a1 first argument |
639 | * @return localized string |
640 | */ |
641 | template <typename A1> |
642 | inline QString i18n (const char *text, const A1 &a1) |
643 | { |
644 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
645 | return ki18n(text).subs(a1).toString(); |
646 | } |
647 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
648 | /** |
649 | * Returns a localized version of a string with 2 arguments. |
650 | * @param text string to be localized |
651 | * @param a1 first argument |
652 | * @param a2 second argument |
653 | * @return localized string |
654 | */ |
655 | template <typename A1, typename A2> |
656 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2) |
657 | { |
658 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
659 | return ki18n(text).subs(a1).subs(a2).toString(); |
660 | } |
661 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
662 | /** |
663 | * Returns a localized version of a string with 3 arguments. |
664 | * @param text string to be localized |
665 | * @param a1 first argument |
666 | * @param a2 second argument |
667 | * @param a3 third argument |
668 | * @return localized string |
669 | */ |
670 | template <typename A1, typename A2, typename A3> |
671 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3) |
672 | { |
673 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
674 | return ki18n(text).subs(a1).subs(a2).subs(a3).toString(); |
675 | } |
676 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
677 | /** |
678 | * Returns a localized version of a string with 4 arguments. |
679 | * @param text string to be localized |
680 | * @param a1 first argument |
681 | * @param a2 second argument |
682 | * @param a3 third argument |
683 | * @param a4 fourth argument |
684 | * @return localized string |
685 | */ |
686 | template <typename A1, typename A2, typename A3, typename A4> |
687 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
688 | { |
689 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
690 | return ki18n(text).subs(a1).subs(a2).subs(a3).subs(a4).toString(); |
691 | } |
692 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
693 | /** |
694 | * Returns a localized version of a string with 5 arguments. |
695 | * @param text string to be localized |
696 | * @param a1 first argument |
697 | * @param a2 second argument |
698 | * @param a3 third argument |
699 | * @param a4 fourth argument |
700 | * @param a5 fifth argument |
701 | * @return localized string |
702 | */ |
703 | template <typename A1, typename A2, typename A3, typename A4, typename A5> |
704 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
705 | { |
706 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
707 | return ki18n(text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).toString(); |
708 | } |
709 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
710 | /** |
711 | * Returns a localized version of a string with 6 arguments. |
712 | * @param text string to be localized |
713 | * @param a1 first argument |
714 | * @param a2 second argument |
715 | * @param a3 third argument |
716 | * @param a4 fourth argument |
717 | * @param a5 fifth argument |
718 | * @param a6 sixth argument |
719 | * @return localized string |
720 | */ |
721 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> |
722 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6) |
723 | { |
724 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
725 | return ki18n(text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).toString(); |
726 | } |
727 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
728 | /** |
729 | * Returns a localized version of a string with 7 arguments. |
730 | * @param text string to be localized |
731 | * @param a1 first argument |
732 | * @param a2 second argument |
733 | * @param a3 third argument |
734 | * @param a4 fourth argument |
735 | * @param a5 fifth argument |
736 | * @param a6 sixth argument |
737 | * @param a7 seventh argument |
738 | * @return localized string |
739 | */ |
740 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> |
741 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7) |
742 | { |
743 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
744 | return ki18n(text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).toString(); |
745 | } |
746 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
747 | /** |
748 | * Returns a localized version of a string with 8 arguments. |
749 | * @param text string to be localized |
750 | * @param a1 first argument |
751 | * @param a2 second argument |
752 | * @param a3 third argument |
753 | * @param a4 fourth argument |
754 | * @param a5 fifth argument |
755 | * @param a6 sixth argument |
756 | * @param a7 seventh argument |
757 | * @param a8 eighth argument |
758 | * @return localized string |
759 | */ |
760 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> |
761 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) |
762 | { |
763 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
764 | return ki18n(text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).toString(); |
765 | } |
766 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
767 | /** |
768 | * Returns a localized version of a string with 9 arguments. |
769 | * @param text string to be localized |
770 | * @param a1 first argument |
771 | * @param a2 second argument |
772 | * @param a3 third argument |
773 | * @param a4 fourth argument |
774 | * @param a5 fifth argument |
775 | * @param a6 sixth argument |
776 | * @param a7 seventh argument |
777 | * @param a8 eighth argument |
778 | * @param a9 ninth argument |
779 | * @return localized string |
780 | */ |
781 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> |
782 | inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) |
783 | { |
784 | STATIC_ASSERT_NOT_LITERAL_STRING(A1) |
785 | return ki18n(text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).subs(a9).toString(); |
786 | } |
787 | // <<<<<<< End of basic calls |
788 | |
789 | // >>>>> Context calls |
790 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
791 | /** |
792 | * Returns a localized version of a string and a context. |
793 | * @param ctxt context of the string |
794 | * @param text string to be localized |
795 | * @return localized string |
796 | */ |
797 | inline QString i18nc (const char *ctxt, const char *text) |
798 | { |
799 | return ki18nc(ctxt, text).toString(); |
800 | } |
801 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
802 | /** |
803 | * Returns a localized version of a string with 1 argument and a context. |
804 | * @param ctxt context of the string |
805 | * @param text string to be localized |
806 | * @param a1 first argument |
807 | * @return localized string |
808 | */ |
809 | template <typename A1> |
810 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1) |
811 | { |
812 | return ki18nc(ctxt, text).subs(a1).toString(); |
813 | } |
814 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
815 | /** |
816 | * Returns a localized version of a string with 2 arguments and a context. |
817 | * @param ctxt context of the string |
818 | * @param text string to be localized |
819 | * @param a1 first argument |
820 | * @param a2 second argument |
821 | * @return localized string |
822 | */ |
823 | template <typename A1, typename A2> |
824 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2) |
825 | { |
826 | return ki18nc(ctxt, text).subs(a1).subs(a2).toString(); |
827 | } |
828 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
829 | /** |
830 | * Returns a localized version of a string with 3 arguments and a context. |
831 | * @param ctxt context of the string |
832 | * @param text string to be localized |
833 | * @param a1 first argument |
834 | * @param a2 second argument |
835 | * @param a3 third argument |
836 | * @return localized string |
837 | */ |
838 | template <typename A1, typename A2, typename A3> |
839 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3) |
840 | { |
841 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).toString(); |
842 | } |
843 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
844 | /** |
845 | * Returns a localized version of a string with 4 arguments and a context. |
846 | * @param ctxt context of the string |
847 | * @param text string to be localized |
848 | * @param a1 first argument |
849 | * @param a2 second argument |
850 | * @param a3 third argument |
851 | * @param a4 fourth argument |
852 | * @return localized string |
853 | */ |
854 | template <typename A1, typename A2, typename A3, typename A4> |
855 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
856 | { |
857 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).subs(a4).toString(); |
858 | } |
859 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
860 | /** |
861 | * Returns a localized version of a string with 5 arguments and a context. |
862 | * @param ctxt context of the string |
863 | * @param text string to be localized |
864 | * @param a1 first argument |
865 | * @param a2 second argument |
866 | * @param a3 third argument |
867 | * @param a4 fourth argument |
868 | * @param a5 fifth argument |
869 | * @return localized string |
870 | */ |
871 | template <typename A1, typename A2, typename A3, typename A4, typename A5> |
872 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
873 | { |
874 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).toString(); |
875 | } |
876 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
877 | /** |
878 | * Returns a localized version of a string with 6 arguments and a context. |
879 | * @param ctxt context of the string |
880 | * @param text string to be localized |
881 | * @param a1 first argument |
882 | * @param a2 second argument |
883 | * @param a3 third argument |
884 | * @param a4 fourth argument |
885 | * @param a5 fifth argument |
886 | * @param a6 sixth argument |
887 | * @return localized string |
888 | */ |
889 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> |
890 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6) |
891 | { |
892 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).toString(); |
893 | } |
894 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
895 | /** |
896 | * Returns a localized version of a string with 7 arguments and a context. |
897 | * @param ctxt context of the string |
898 | * @param text string to be localized |
899 | * @param a1 first argument |
900 | * @param a2 second argument |
901 | * @param a3 third argument |
902 | * @param a4 fourth argument |
903 | * @param a5 fifth argument |
904 | * @param a6 sixth argument |
905 | * @param a7 seventh argument |
906 | * @return localized string |
907 | */ |
908 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> |
909 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7) |
910 | { |
911 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).toString(); |
912 | } |
913 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
914 | /** |
915 | * Returns a localized version of a string with 8 arguments and a context. |
916 | * @param ctxt context of the string |
917 | * @param text string to be localized |
918 | * @param a1 first argument |
919 | * @param a2 second argument |
920 | * @param a3 third argument |
921 | * @param a4 fourth argument |
922 | * @param a5 fifth argument |
923 | * @param a6 sixth argument |
924 | * @param a7 seventh argument |
925 | * @param a8 eighth argument |
926 | * @return localized string |
927 | */ |
928 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> |
929 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) |
930 | { |
931 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).toString(); |
932 | } |
933 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
934 | /** |
935 | * Returns a localized version of a string with 9 arguments and a context. |
936 | * @param ctxt context of the string |
937 | * @param text string to be localized |
938 | * @param a1 first argument |
939 | * @param a2 second argument |
940 | * @param a3 third argument |
941 | * @param a4 fourth argument |
942 | * @param a5 fifth argument |
943 | * @param a6 sixth argument |
944 | * @param a7 seventh argument |
945 | * @param a8 eighth argument |
946 | * @param a9 ninth argument |
947 | * @return localized string |
948 | */ |
949 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> |
950 | inline QString i18nc (const char *ctxt, const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) |
951 | { |
952 | return ki18nc(ctxt, text).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).subs(a9).toString(); |
953 | } |
954 | // <<<<< End of context calls |
955 | |
956 | // >>>>> Plural calls |
957 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
958 | /** |
959 | * Returns a localized version of a string with 1 argument using correct plural form. |
960 | * @param sing string to be localized in singular |
961 | * @param plur string to be localized in plural |
962 | * @param a1 first argument |
963 | * @return localized string |
964 | */ |
965 | template <typename A1> |
966 | inline QString i18np (const char *sing, const char *plur, const A1 &a1) |
967 | { |
968 | return ki18np(sing, plur).subs(a1).toString(); |
969 | } |
970 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
971 | /** |
972 | * Returns a localized version of a string with 2 arguments using correct plural form. |
973 | * @param sing string to be localized in singular |
974 | * @param plur string to be localized in plural |
975 | * @param a1 first argument |
976 | * @param a2 second argument |
977 | * @return localized string |
978 | */ |
979 | template <typename A1, typename A2> |
980 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2) |
981 | { |
982 | return ki18np(sing, plur).subs(a1).subs(a2).toString(); |
983 | } |
984 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
985 | /** |
986 | * Returns a localized version of a string with 3 arguments using correct plural form. |
987 | * @param sing string to be localized in singular |
988 | * @param plur string to be localized in plural |
989 | * @param a1 first argument |
990 | * @param a2 second argument |
991 | * @param a3 third argument |
992 | * @return localized string |
993 | */ |
994 | template <typename A1, typename A2, typename A3> |
995 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3) |
996 | { |
997 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).toString(); |
998 | } |
999 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1000 | /** |
1001 | * Returns a localized version of a string with 4 arguments using correct plural form. |
1002 | * @param sing string to be localized in singular |
1003 | * @param plur string to be localized in plural |
1004 | * @param a1 first argument |
1005 | * @param a2 second argument |
1006 | * @param a3 third argument |
1007 | * @param a4 fourth argument |
1008 | * @return localized string |
1009 | */ |
1010 | template <typename A1, typename A2, typename A3, typename A4> |
1011 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
1012 | { |
1013 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).toString(); |
1014 | } |
1015 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1016 | /** |
1017 | * Returns a localized version of a string with 5 arguments using correct plural form. |
1018 | * @param sing string to be localized in singular |
1019 | * @param plur string to be localized in plural |
1020 | * @param a1 first argument |
1021 | * @param a2 second argument |
1022 | * @param a3 third argument |
1023 | * @param a4 fourth argument |
1024 | * @param a5 fifth argument |
1025 | * @return localized string |
1026 | */ |
1027 | template <typename A1, typename A2, typename A3, typename A4, typename A5> |
1028 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
1029 | { |
1030 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).toString(); |
1031 | } |
1032 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1033 | /** |
1034 | * Returns a localized version of a string with 6 arguments using correct plural form. |
1035 | * @param sing string to be localized in singular |
1036 | * @param plur string to be localized in plural |
1037 | * @param a1 first argument |
1038 | * @param a2 second argument |
1039 | * @param a3 third argument |
1040 | * @param a4 fourth argument |
1041 | * @param a5 fifth argument |
1042 | * @param a6 sixth argument |
1043 | * @return localized string |
1044 | */ |
1045 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> |
1046 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6) |
1047 | { |
1048 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).toString(); |
1049 | } |
1050 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1051 | /** |
1052 | * Returns a localized version of a string with 7 arguments using correct plural form. |
1053 | * @param sing string to be localized in singular |
1054 | * @param plur string to be localized in plural |
1055 | * @param a1 first argument |
1056 | * @param a2 second argument |
1057 | * @param a3 third argument |
1058 | * @param a4 fourth argument |
1059 | * @param a5 fifth argument |
1060 | * @param a6 sixth argument |
1061 | * @param a7 seventh argument |
1062 | * @return localized string |
1063 | */ |
1064 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> |
1065 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7) |
1066 | { |
1067 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).toString(); |
1068 | } |
1069 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1070 | /** |
1071 | * Returns a localized version of a string with 8 arguments using correct plural form. |
1072 | * @param sing string to be localized in singular |
1073 | * @param plur string to be localized in plural |
1074 | * @param a1 first argument |
1075 | * @param a2 second argument |
1076 | * @param a3 third argument |
1077 | * @param a4 fourth argument |
1078 | * @param a5 fifth argument |
1079 | * @param a6 sixth argument |
1080 | * @param a7 seventh argument |
1081 | * @param a8 eighth argument |
1082 | * @return localized string |
1083 | */ |
1084 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> |
1085 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) |
1086 | { |
1087 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).toString(); |
1088 | } |
1089 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1090 | /** |
1091 | * Returns a localized version of a string with 9 arguments using correct plural form. |
1092 | * @param sing string to be localized in singular |
1093 | * @param plur string to be localized in plural |
1094 | * @param a1 first argument |
1095 | * @param a2 second argument |
1096 | * @param a3 third argument |
1097 | * @param a4 fourth argument |
1098 | * @param a5 fifth argument |
1099 | * @param a6 sixth argument |
1100 | * @param a7 seventh argument |
1101 | * @param a8 eighth argument |
1102 | * @param a9 ninth argument |
1103 | * @return localized string |
1104 | */ |
1105 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> |
1106 | inline QString i18np (const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) |
1107 | { |
1108 | return ki18np(sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).subs(a9).toString(); |
1109 | } |
1110 | // <<<<< End of plural calls |
1111 | |
1112 | // >>>>> Context-plural calls |
1113 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1114 | /** |
1115 | * Returns a localized version of a string with 1 argument and a context using correct plural form. |
1116 | * @param ctxt context of the string |
1117 | * @param sing string to be localized in singular |
1118 | * @param plur string to be localized in plural |
1119 | * @param a1 first argument |
1120 | * @return localized string |
1121 | */ |
1122 | template <typename A1> |
1123 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1) |
1124 | { |
1125 | return ki18ncp(ctxt, sing, plur).subs(a1).toString(); |
1126 | } |
1127 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1128 | /** |
1129 | * Returns a localized version of a string with 2 arguments and a context using correct plural form. |
1130 | * @param ctxt context of the string |
1131 | * @param sing string to be localized in singular |
1132 | * @param plur string to be localized in plural |
1133 | * @param a1 first argument |
1134 | * @param a2 second argument |
1135 | * @return localized string |
1136 | */ |
1137 | template <typename A1, typename A2> |
1138 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2) |
1139 | { |
1140 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).toString(); |
1141 | } |
1142 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1143 | /** |
1144 | * Returns a localized version of a string with 3 arguments and a context using correct plural form. |
1145 | * @param ctxt context of the string |
1146 | * @param sing string to be localized in singular |
1147 | * @param plur string to be localized in plural |
1148 | * @param a1 first argument |
1149 | * @param a2 second argument |
1150 | * @param a3 third argument |
1151 | * @return localized string |
1152 | */ |
1153 | template <typename A1, typename A2, typename A3> |
1154 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3) |
1155 | { |
1156 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).toString(); |
1157 | } |
1158 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1159 | /** |
1160 | * Returns a localized version of a string with 4 arguments and a context using correct plural form. |
1161 | * @param ctxt context of the string |
1162 | * @param sing string to be localized in singular |
1163 | * @param plur string to be localized in plural |
1164 | * @param a1 first argument |
1165 | * @param a2 second argument |
1166 | * @param a3 third argument |
1167 | * @param a4 fourth argument |
1168 | * @return localized string |
1169 | */ |
1170 | template <typename A1, typename A2, typename A3, typename A4> |
1171 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
1172 | { |
1173 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).toString(); |
1174 | } |
1175 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1176 | /** |
1177 | * Returns a localized version of a string with 5 arguments and a context using correct plural form. |
1178 | * @param ctxt context of the string |
1179 | * @param sing string to be localized in singular |
1180 | * @param plur string to be localized in plural |
1181 | * @param a1 first argument |
1182 | * @param a2 second argument |
1183 | * @param a3 third argument |
1184 | * @param a4 fourth argument |
1185 | * @param a5 fifth argument |
1186 | * @return localized string |
1187 | */ |
1188 | template <typename A1, typename A2, typename A3, typename A4, typename A5> |
1189 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
1190 | { |
1191 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).toString(); |
1192 | } |
1193 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1194 | /** |
1195 | * Returns a localized version of a string with 6 arguments and a context using correct plural form. |
1196 | * @param ctxt context of the string |
1197 | * @param sing string to be localized in singular |
1198 | * @param plur string to be localized in plural |
1199 | * @param a1 first argument |
1200 | * @param a2 second argument |
1201 | * @param a3 third argument |
1202 | * @param a4 fourth argument |
1203 | * @param a5 fifth argument |
1204 | * @param a6 sixth argument |
1205 | * @return localized string |
1206 | */ |
1207 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> |
1208 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6) |
1209 | { |
1210 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).toString(); |
1211 | } |
1212 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1213 | /** |
1214 | * Returns a localized version of a string with 7 arguments and a context using correct plural form. |
1215 | * @param ctxt context of the string |
1216 | * @param sing string to be localized in singular |
1217 | * @param plur string to be localized in plural |
1218 | * @param a1 first argument |
1219 | * @param a2 second argument |
1220 | * @param a3 third argument |
1221 | * @param a4 fourth argument |
1222 | * @param a5 fifth argument |
1223 | * @param a6 sixth argument |
1224 | * @param a7 seventh argument |
1225 | * @return localized string |
1226 | */ |
1227 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> |
1228 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7) |
1229 | { |
1230 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).toString(); |
1231 | } |
1232 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1233 | /** |
1234 | * Returns a localized version of a string with 8 arguments and a context using correct plural form. |
1235 | * @param ctxt context of the string |
1236 | * @param sing string to be localized in singular |
1237 | * @param plur string to be localized in plural |
1238 | * @param a1 first argument |
1239 | * @param a2 second argument |
1240 | * @param a3 third argument |
1241 | * @param a4 fourth argument |
1242 | * @param a5 fifth argument |
1243 | * @param a6 sixth argument |
1244 | * @param a7 seventh argument |
1245 | * @param a8 eighth argument |
1246 | * @return localized string |
1247 | */ |
1248 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> |
1249 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) |
1250 | { |
1251 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).toString(); |
1252 | } |
1253 | // Autogenerated; contact KLocalizedString maintainer for batch changes. |
1254 | /** |
1255 | * Returns a localized version of a string with 9 arguments and a context using correct plural form. |
1256 | * @param ctxt context of the string |
1257 | * @param sing string to be localized in singular |
1258 | * @param plur string to be localized in plural |
1259 | * @param a1 first argument |
1260 | * @param a2 second argument |
1261 | * @param a3 third argument |
1262 | * @param a4 fourth argument |
1263 | * @param a5 fifth argument |
1264 | * @param a6 sixth argument |
1265 | * @param a7 seventh argument |
1266 | * @param a8 eighth argument |
1267 | * @param a9 ninth argument |
1268 | * @return localized string |
1269 | */ |
1270 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> |
1271 | inline QString i18ncp (const char *ctxt, const char *sing, const char *plur, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) |
1272 | { |
1273 | return ki18ncp(ctxt, sing, plur).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).subs(a9).toString(); |
1274 | } |
1275 | // <<<<< End of context-plural calls |
1276 | |
1277 | #endif |
1278 | |