diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-12-10 16:12:08 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-12-10 21:39:03 +0100 |
commit | 36beb79184e5f4153c8cc92b176b21b697594228 (patch) | |
tree | c4d88424b33ac19d7f6a6e3db9ec6172462d7f32 /include | |
parent | b0789a2cd82f8bf1e16fb9212a608068d99a2344 (diff) |
Add a localisation API to LibreOfficeKitClass
Combines the LanguageTag::Create() and Translate::get() functionality.
Also add an ABI test for the Kit class in the LibreOfficeKit unit
test, and a test for the translation function.
(In this branch there is no Translate::nget() so no such
functionality.)
Change-Id: I78c48a8bbb434d6f204869290822830288022a53
Reviewed-on: https://gerrit.libreoffice.org/64894
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 10 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 29 |
2 files changed, 39 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 0581513d7701..583e5b7f23d7 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -94,6 +94,16 @@ struct _LibreOfficeKitClass @since LibreOffice 6.0 */ int (*runMacro) (LibreOfficeKit *pThis, const char* pURL); + + /** @see lok::Office::translateGet(). + @since LibreOffice 6.3 + */ + char* (*translateGet) (LibreOfficeKit *pThis, const char* pId, const char* pPrefixName, const char* pBcp47LanguageTag); + + /** @see lok::Office::translateNGet(). + @since LibreOffice 6.3 + */ + char* (*translateNGet) (LibreOfficeKit *pThis, const char* pId, int n, const char* pPrefixName, const char* pBcp47LanguageTag); }; #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize) diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index ffcb87f4e5d0..f0e77bdb40ec 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -763,6 +763,35 @@ public: { return mpThis->pClass->runMacro( mpThis, pURL ); } + + /** + * Fetch translation for a string. + * + * @since LibreOffice 6.3 + * @returns the translated string, if available + * @param pId the context and string, separated by a '\004' character + * @param pPrefixName the prefix passed to Translate::Create() + * @param pBcp47LanguageTag the locale into which the string should be translated + */ + char* translateGet( const char* pId, const char* pPrefixName, const char* pBcp47LanguageTag ) + { + return mpThis->pClass->translateGet( mpThis, pId, pPrefixName, pBcp47LanguageTag ); + } + + /** + * In this branch this is equivalent to translateGet(). + * + * @since LibreOffice 6.3 + * @returns the translated string, if available + * @param pId the context and string, separated by a '\004' character + * @param n Ignored in this branch + * @param pPrefixName the prefix passed to Translate::Create() + * @param pBcp47LanguageTag the locale into which the string should be translated + */ + char* translateNGet( const char* pId, int n, const char* pPrefixName, const char* pBcp47LanguageTag ) + { + return mpThis->pClass->translateNGet( mpThis, pId, n, pPrefixName, pBcp47LanguageTag ); + } }; /// Factory method to create a lok::Office instance. |