Changeset View
Changeset View
Standalone View
Standalone View
src/klocalizedstring.h
Show First 20 Lines • Show All 643 Lines • ▼ Show 20 Line(s) | 642 | KLocalizedString(const char *domain, | |||
---|---|---|---|---|---|
644 | bool markupAware); | 644 | bool markupAware); | ||
645 | 645 | | |||
646 | KLocalizedStringPrivate *const d; | 646 | KLocalizedStringPrivate *const d; | ||
647 | }; | 647 | }; | ||
648 | 648 | | |||
649 | // Do not document every multi-argument i18n* call separately, | 649 | // Do not document every multi-argument i18n* call separately, | ||
650 | // but provide special quasi-calls that only Doxygen sees. | 650 | // but provide special quasi-calls that only Doxygen sees. | ||
651 | // Placed in front of ki18n* calls, because i18n* are more basic. | 651 | // Placed in front of ki18n* calls, because i18n* are more basic. | ||
652 | #ifdef DOXYGEN_PREPROC | 652 | #ifdef DOXYGEN_SHOULD_SKIP_THIS | ||
653 | 653 | | |||
654 | /** | 654 | /** | ||
655 | * Translate a string and substitute any arguments. | 655 | * Translate a string and substitute any arguments. | ||
656 | * | 656 | * | ||
657 | * \param text string to translate | 657 | * \param text string to translate | ||
658 | * \param arg arguments to insert (0 to 9), | 658 | * \param arg arguments to insert (0 to 9), | ||
659 | * admissible types according to \c KLocalizedString::subs methods | 659 | * admissible types according to \c KLocalizedString::subs methods | ||
660 | * \return translated string | 660 | * \return translated string | ||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Line(s) | |||||
845 | * \param arg arguments to insert (0 to 9), | 845 | * \param arg arguments to insert (0 to 9), | ||
846 | * admissible types according to \c KLocalizedString::subs methods | 846 | * admissible types according to \c KLocalizedString::subs methods | ||
847 | * \return translated string | 847 | * \return translated string | ||
848 | */ | 848 | */ | ||
849 | QString xi18ndcp(const char *domain, | 849 | QString xi18ndcp(const char *domain, | ||
850 | const char *context, const char *singular, const char *plural, | 850 | const char *context, const char *singular, const char *plural, | ||
851 | const TYPE &arg...); | 851 | const TYPE &arg...); | ||
852 | 852 | | |||
853 | #endif // DOXYGEN_PREPROC | 853 | #endif // DOXYGEN_SHOULD_SKIP_THIS | ||
854 | 854 | | |||
855 | /** | 855 | /** | ||
856 | * Create non-finalized translated string. | 856 | * Create non-finalized translated string. | ||
857 | * | 857 | * | ||
858 | * \param text string to translate | 858 | * \param text string to translate | ||
859 | * \return non-finalized translated string | 859 | * \return non-finalized translated string | ||
860 | */ | 860 | */ | ||
861 | KLocalizedString KI18N_EXPORT ki18n(const char *text); | 861 | KLocalizedString KI18N_EXPORT ki18n(const char *text); | ||
▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Line(s) | 1084 | if (comment && comment[0] && text && text[0]) { | |||
1085 | return kxi18ndc(domain, comment, text).toString(); | 1085 | return kxi18ndc(domain, comment, text).toString(); | ||
1086 | } else if (text && text[0]) { | 1086 | } else if (text && text[0]) { | ||
1087 | return kxi18nd(domain, text).toString(); | 1087 | return kxi18nd(domain, text).toString(); | ||
1088 | } else { | 1088 | } else { | ||
1089 | return QString(); | 1089 | return QString(); | ||
1090 | } | 1090 | } | ||
1091 | } | 1091 | } | ||
1092 | 1092 | | |||
1093 | #ifndef DOXYGEN_PREPROC | 1093 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | ||
1094 | 1094 | | |||
1095 | #ifndef NDEBUG | 1095 | #ifndef NDEBUG | ||
1096 | #define I18N_ERR_MSG String_literal_as_second_argument_to_i18n___Perhaps_you_need_i18nc_or_i18np | 1096 | #define I18N_ERR_MSG String_literal_as_second_argument_to_i18n___Perhaps_you_need_i18nc_or_i18np | ||
1097 | template <typename T, int s> class I18nTypeCheck | 1097 | template <typename T, int s> class I18nTypeCheck | ||
1098 | { | 1098 | { | ||
1099 | public: static void I18N_ERR_MSG() {} | 1099 | public: static void I18N_ERR_MSG() {} | ||
1100 | }; | 1100 | }; | ||
1101 | template <int s> class I18nTypeCheck<char[s], s> {}; | 1101 | template <int s> class I18nTypeCheck<char[s], s> {}; | ||
▲ Show 20 Lines • Show All 849 Lines • ▼ Show 20 Line(s) | |||||
1951 | } | 1951 | } | ||
1952 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> | 1952 | template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> | ||
1953 | inline QString xi18ndcp(const char *domain, const char *context, const char *singular, const char *plural, 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) | 1953 | inline QString xi18ndcp(const char *domain, const char *context, const char *singular, const char *plural, 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) | ||
1954 | { | 1954 | { | ||
1955 | return kxi18ndcp(domain, context, singular, plural).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).subs(a9).toString(); | 1955 | return kxi18ndcp(domain, context, singular, plural).subs(a1).subs(a2).subs(a3).subs(a4).subs(a5).subs(a6).subs(a7).subs(a8).subs(a9).toString(); | ||
1956 | } | 1956 | } | ||
1957 | // <<<<< End of markup-aware context-plural calls with domain | 1957 | // <<<<< End of markup-aware context-plural calls with domain | ||
1958 | 1958 | | |||
1959 | #endif // DOXYGEN_PREPROC | 1959 | #endif // DOXYGEN_SHOULD_SKIP_THIS | ||
1960 | 1960 | | |||
1961 | #endif // KLOCALIZEDSTRING_H | 1961 | #endif // KLOCALIZEDSTRING_H | ||
1962 | 1962 | | |||
1963 | #ifndef DOXYGEN_PREPROC | 1963 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | ||
1964 | 1964 | | |||
1965 | // Outside of include guards, to be able to map and unmap domains | 1965 | // Outside of include guards, to be able to map and unmap domains | ||
1966 | // by successive inclusions of this header | 1966 | // by successive inclusions of this header | ||
1967 | // preceded with different definitions of TRANSLATION_DOMAIN. | 1967 | // preceded with different definitions of TRANSLATION_DOMAIN. | ||
1968 | #ifdef TRANSLATION_DOMAIN | 1968 | #ifdef TRANSLATION_DOMAIN | ||
1969 | #define i18n(...) i18nd(TRANSLATION_DOMAIN, __VA_ARGS__) | 1969 | #define i18n(...) i18nd(TRANSLATION_DOMAIN, __VA_ARGS__) | ||
1970 | #define i18nc(...) i18ndc(TRANSLATION_DOMAIN, __VA_ARGS__) | 1970 | #define i18nc(...) i18ndc(TRANSLATION_DOMAIN, __VA_ARGS__) | ||
1971 | #define i18np(...) i18ndp(TRANSLATION_DOMAIN, __VA_ARGS__) | 1971 | #define i18np(...) i18ndp(TRANSLATION_DOMAIN, __VA_ARGS__) | ||
Show All 28 Lines | |||||
2000 | #undef xi18ncp | 2000 | #undef xi18ncp | ||
2001 | #undef kxi18n | 2001 | #undef kxi18n | ||
2002 | #undef kxi18nc | 2002 | #undef kxi18nc | ||
2003 | #undef kxi18np | 2003 | #undef kxi18np | ||
2004 | #undef kxi18ncp | 2004 | #undef kxi18ncp | ||
2005 | #undef tr2xi18n | 2005 | #undef tr2xi18n | ||
2006 | #endif | 2006 | #endif | ||
2007 | 2007 | | |||
2008 | #endif // DOXYGEN_PREPROC | 2008 | #endif // DOXYGEN_SHOULD_SKIP_THIS |