diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-12-10 16:12:08 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-12-10 18:31:18 +0100 |
commit | 4f1a341bc312673b8d92e4474cc39bc3ab69aa5b (patch) | |
tree | 169e66e3087705f521d97dfdd0d6dba827d2127e /include/LibreOfficeKit | |
parent | ee855a377f962eb8dff2224bb6412c2243535fb0 (diff) |
Add a localisation API to LibreOfficeKitClass
Combines the LanguageTag::Create() and Translate::get() (or nget())
functionality.
Also add an ABI test for the Kit class in the LibreOfficeKit unit
test, and a test for the translation function.
Change-Id: I78c48a8bbb434d6f204869290822830288022a53
Reviewed-on: https://gerrit.libreoffice.org/64882
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 10 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 23 |
2 files changed, 33 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 4dd23a2cbc7a..68074a637899 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 5d7771cf80b0..93a0717ae588 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -791,6 +791,29 @@ 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 ); + + /** + * Fetch translation for a string corresponding to a specific number of something. + * + * @since LibreOffice 6.3 + * @returns the translated string, if available + * @param pId the context and string, separated by a '\004' character + * @param n the number + * @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 ); }; /// Factory method to create a lok::Office instance. |