diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-11 20:56:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-21 08:20:50 +0100 |
commit | 00657aef09d854c74fb426a935a3e8b1fc390bb0 (patch) | |
tree | fd1a9bb264fe15dcc129498e62060ecd256b1ee7 /sw/source/core/tox | |
parent | fa987cbb813cfd729fe490f2f1258b7c8d7fb174 (diff) |
migrate to boost::gettext
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl
* all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string")
* ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching
MODULE .mo files
* UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui
goes from l10n target to normal one, so the res/lang.zips of UI files go away
* translation via Translation::get(hrc-define-key, imbued-std::locale)
* python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there
to keep finding the .hrc file uniform) so magic numbers can go away there
* java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation
mechanism
* en-US res files go away, their strings are now the .hrc keys in the source code
* remaining .res files are replaced by .mo files
* in .res/.ui-lang-zip files, the old scheme missing translations of strings
results in inserting the english original so something can be found, now the
standard fallback of using the english original from the source key is used, so
partial translations shrink dramatically in size
* extract .hrc strings with hrcex which backs onto
xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap
* extract .ui strings with uiex which backs onto
xgettext --add-comments --no-wrap
* qtz for gettext translations is generated at runtime as ascii-ified crc32 of
content + "|" + msgid
* [API CHANGE] remove deprecated binary .res resouce loader related uno apis
com::sun::star::resource::OfficeResourceLoader
com::sun::star::resource::XResourceBundleLoader
com::sun::star::resource::XResourceBundle
when translating strings via uno apis
com.sun.star.resource.StringResourceWithLocation
can continue to be used
Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
Diffstat (limited to 'sw/source/core/tox')
-rw-r--r-- | sw/source/core/tox/ToxLinkProcessor.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/tox/tox.cxx | 128 | ||||
-rw-r--r-- | sw/source/core/tox/txmsrt.cxx | 7 |
3 files changed, 111 insertions, 26 deletions
diff --git a/sw/source/core/tox/ToxLinkProcessor.cxx b/sw/source/core/tox/ToxLinkProcessor.cxx index 674008bb165c..b30d8a41ebca 100644 --- a/sw/source/core/tox/ToxLinkProcessor.cxx +++ b/sw/source/core/tox/ToxLinkProcessor.cxx @@ -13,7 +13,7 @@ #include "SwStyleNameMapper.hxx" #include "ndtxt.hxx" #include <o3tl/make_unique.hxx> -#include <poolfmt.hrc> +#include <strings.hrc> #include <stdexcept> diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index b6baa1366d96..f35d49fd9799 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -17,14 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/resid.hxx> #include <hintids.hxx> #include <swtypes.hxx> #include <txtatr.hxx> #include <ndtxt.hxx> #include <txttxmrk.hxx> #include <tox.hxx> -#include <poolfmt.hrc> +#include <strings.hrc> #include <doc.hxx> #include <docary.hxx> #include <paratr.hxx> @@ -211,6 +210,91 @@ SwTOXType::SwTOXType(const SwTOXType& rCopy) { } +static const char* STR_POOLCOLL_TOX_ARY[] = +{ + // Subcategory Index-Directories + STR_POOLCOLL_TOX_IDXH, + STR_POOLCOLL_TOX_IDX1, + STR_POOLCOLL_TOX_IDX2, + STR_POOLCOLL_TOX_IDX3, + STR_POOLCOLL_TOX_IDXBREAK +}; + +static const char* STR_POOLCOLL_TOX_CNTNT_ARY[] = +{ + // Subcategory Tables of Contents + STR_POOLCOLL_TOX_CNTNTH, + STR_POOLCOLL_TOX_CNTNT1, + STR_POOLCOLL_TOX_CNTNT2, + STR_POOLCOLL_TOX_CNTNT3, + STR_POOLCOLL_TOX_CNTNT4, + STR_POOLCOLL_TOX_CNTNT5 +}; + +static const char* STR_POOLCOLL_TOX_CNTNT_EXTRA_ARY[] = +{ + // Subcategory Table of Contents more Levels 5 - 10 + STR_POOLCOLL_TOX_CNTNT6, + STR_POOLCOLL_TOX_CNTNT7, + STR_POOLCOLL_TOX_CNTNT8, + STR_POOLCOLL_TOX_CNTNT9, + STR_POOLCOLL_TOX_CNTNT10 +}; + +static const char* STR_POOLCOLL_TOX_USER_ARY[] = +{ + // Subcategory User-Directories: + STR_POOLCOLL_TOX_USERH, + STR_POOLCOLL_TOX_USER1, + STR_POOLCOLL_TOX_USER2, + STR_POOLCOLL_TOX_USER3, + STR_POOLCOLL_TOX_USER4, + STR_POOLCOLL_TOX_USER5 +}; + +static const char* STR_POOLCOLL_TOX_USER_EXTRA_ARY[] = +{ + // Subcategory User-Directories more Levels 5 - 10 + STR_POOLCOLL_TOX_USER6, + STR_POOLCOLL_TOX_USER7, + STR_POOLCOLL_TOX_USER8, + STR_POOLCOLL_TOX_USER9, + STR_POOLCOLL_TOX_USER10 +}; + +static const char* STR_POOLCOLL_TOX_ILLUS_ARY[] = +{ + // Illustrations Index + STR_POOLCOLL_TOX_ILLUSH, + STR_POOLCOLL_TOX_ILLUS1 +}; + +static const char* STR_POOLCOLL_TOX_OBJECT_ARY[] = +{ + // Object Index + STR_POOLCOLL_TOX_OBJECTH, + STR_POOLCOLL_TOX_OBJECT1 +}; + +static const char* STR_POOLCOLL_TOX_TABLES_ARY[] = +{ + // Tables Index + STR_POOLCOLL_TOX_TABLESH, + STR_POOLCOLL_TOX_TABLES1 +}; + +static const char* STR_POOLCOLL_TOX_AUTHORITIES_ARY[] = +{ + // Index of Authorities + STR_POOLCOLL_TOX_AUTHORITIESH, + STR_POOLCOLL_TOX_AUTHORITIES1 +}; + +static const char* STR_POOLCOLL_TOX_CITATION_ARY[] = +{ + STR_POOLCOLL_TOX_CITATION +}; + // Edit forms SwForm::SwForm( TOXTypes eTyp ) // #i21237# : m_eType( eTyp ), m_nFormMaxLevel( SwForm::GetFormMaxLevel( eTyp )), @@ -225,17 +309,17 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# // Keyword has 3 levels + headings+ separator // Indexes of tables, object illustrations and authorities consist of a heading and one level - sal_uInt16 nPoolId; + const char** pPoolId; switch( m_eType ) { - case TOX_INDEX: nPoolId = STR_POOLCOLL_TOX_IDXH; break; - case TOX_USER: nPoolId = STR_POOLCOLL_TOX_USERH; break; - case TOX_CONTENT: nPoolId = STR_POOLCOLL_TOX_CNTNTH; break; - case TOX_ILLUSTRATIONS: nPoolId = STR_POOLCOLL_TOX_ILLUSH; break; - case TOX_OBJECTS : nPoolId = STR_POOLCOLL_TOX_OBJECTH; break; - case TOX_TABLES : nPoolId = STR_POOLCOLL_TOX_TABLESH; break; - case TOX_AUTHORITIES : nPoolId = STR_POOLCOLL_TOX_AUTHORITIESH; break; - case TOX_CITATION : nPoolId = STR_POOLCOLL_TOX_CITATION; break; + case TOX_INDEX: pPoolId = STR_POOLCOLL_TOX_ARY; break; + case TOX_USER: pPoolId = STR_POOLCOLL_TOX_USER_ARY; break; + case TOX_CONTENT: pPoolId = STR_POOLCOLL_TOX_CNTNT_ARY; break; + case TOX_ILLUSTRATIONS: pPoolId = STR_POOLCOLL_TOX_ILLUS_ARY; break; + case TOX_OBJECTS : pPoolId = STR_POOLCOLL_TOX_OBJECT_ARY; break; + case TOX_TABLES : pPoolId = STR_POOLCOLL_TOX_TABLES_ARY; break; + case TOX_AUTHORITIES : pPoolId = STR_POOLCOLL_TOX_AUTHORITIES_ARY; break; + case TOX_CITATION : pPoolId = STR_POOLCOLL_TOX_CITATION_ARY; break; default: OSL_ENSURE( false, "invalid TOXTyp"); return ; @@ -273,7 +357,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# if (TOX_CONTENT == m_eType || TOX_ILLUSTRATIONS == m_eType) aTokens.push_back(SwFormToken(TOKEN_LINK_END)); - SetTemplate( 0, SwResId( nPoolId++ )); + SetTemplate(0, SwResId(*pPoolId++)); if(TOX_INDEX == m_eType) { @@ -286,19 +370,20 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# aTmpTokens.push_back(aTmpToken); SetPattern( i, aTmpTokens ); - SetTemplate( i, SwResId( STR_POOLCOLL_TOX_IDXBREAK )); + SetTemplate(i, SwResId(STR_POOLCOLL_TOX_IDXBREAK)); } else { SetPattern( i, aTokens ); - SetTemplate( i, SwResId( STR_POOLCOLL_TOX_IDX1 + i - 2 )); + SetTemplate(i, SwResId(STR_POOLCOLL_TOX_ARY[i - 1])); } } } else - for( sal_uInt16 i = 1; i < GetFormMax(); ++i, ++nPoolId ) // Number 0 is the title + { + for (sal_uInt16 i = 1; i < GetFormMax(); ++i, ++pPoolId) // Number 0 is the title { - if(TOX_AUTHORITIES == m_eType) + if (TOX_AUTHORITIES == m_eType) { SwFormTokens aAuthTokens; lcl_FillAuthPattern(aAuthTokens, i); @@ -308,13 +393,14 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# SetPattern( i, aTokens ); if( TOX_CONTENT == m_eType && 6 == i ) - nPoolId = STR_POOLCOLL_TOX_CNTNT6; + pPoolId = STR_POOLCOLL_TOX_CNTNT_EXTRA_ARY; else if( TOX_USER == m_eType && 6 == i ) - nPoolId = STR_POOLCOLL_TOX_USER6; - else if( TOX_AUTHORITIES == m_eType ) - nPoolId = STR_POOLCOLL_TOX_AUTHORITIES1; - SetTemplate( i, SwResId( nPoolId ) ); + pPoolId = STR_POOLCOLL_TOX_USER_EXTRA_ARY; + else if( TOX_AUTHORITIES == m_eType ) //reuse the same STR_POOLCOLL_TOX_AUTHORITIES1 id each time + pPoolId = STR_POOLCOLL_TOX_AUTHORITIES_ARY + 1; + SetTemplate(i, SwResId(*pPoolId)); } + } } SwForm::SwForm(const SwForm& rForm) diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index e304e1092b49..14600c68af1b 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/resid.hxx> #include <unotools/charclass.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <editeng/unolingu.hxx> @@ -40,7 +39,7 @@ #include <authfld.hxx> #include <toxwrap.hxx> -#include <comcore.hrc> +#include <strings.hrc> #include <numrule.hxx> #include <reffld.hxx> @@ -517,12 +516,12 @@ TextAndReading SwTOXPara::GetText_Impl() const return TextAndReading(pFly->GetName(), OUString()); OSL_ENSURE( false, "Graphic/object without name" ); - sal_uInt16 nId = SwTOXElement::Ole == eType + const char* pId = SwTOXElement::Ole == eType ? STR_OBJECT_DEFNAME : SwTOXElement::Graphic == eType ? STR_GRAPHIC_DEFNAME : STR_FRAME_DEFNAME; - return TextAndReading(SwResId( nId ), OUString()); + return TextAndReading(SwResId(pId), OUString()); } break; default: break; |