sc/source/ui/inc/content.hxx | 2 ++ sc/source/ui/navipi/content.cxx | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
New commits: commit 3dff3a50dfda011c8bfb5502f6a8d1e7f8b95d59 Author: Attila Szűcs <attila.sz...@collabora.com> AuthorDate: Tue Nov 7 15:03:33 2023 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Nov 16 04:02:36 2023 +0100 SC navigator: fix changing language of contenttree Saved the actual language, when ScContentTree is created, and use that language to localise is text. Note: Saving language in ScContentTree::ScContentTree caused problems, so it replaced into where this tree filled with text at the first time. In case of LOK, there can be seapate views, with different languages, that means there can be 2+ ScContentTree, one have text in English and the other in German. When new item is created that is listed in navigator, then every ScContentTree is updated at once... but that would use the global laguage, not the one what was used when the actual ScContentTree was created. Change-Id: I2dedf293e0ad9fb8f3cdd1090e1e1707a9f6cfa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159077 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index 9cd7e977319d..3f179860cce7 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -59,6 +59,8 @@ class ScContentTree o3tl::enumarray<ScContentId, sal_uInt16> pPosList; // for the sequence + std::unique_ptr<std::locale> m_pResLocaleForLOK; //it needed only in case of LOK + ScDocShell* GetManualOrCurrent(); void InitRoot(ScContentId nType); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 1387abd44346..7c3d2b7d022b 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -188,7 +188,23 @@ void ScContentTree::InitRoot( ScContentId nType ) } auto const aImage(aContentBmps[static_cast<int>(nType) - 1]); - OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast<int>(nType)])); + + OUString aName; + if(comphelper::LibreOfficeKit::isActive()) + { + //In case of LOK we may have many different languaged ScContentTree + //At creation time, we store what language we use, and then use it later too. + //It not work in the constructor, that is why it is here. + if (!m_pResLocaleForLOK) + { + m_pResLocaleForLOK = std::make_unique<std::locale>(SC_MOD()->GetResLocale()); + } + aName = Translate::get(SCSTR_CONTENT_ARY[static_cast<int>(nType)], *m_pResLocaleForLOK); + } + else + { + aName = ScResId(SCSTR_CONTENT_ARY[static_cast<int>(nType)]); + } // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; m_aRootNodes[nType] = m_xTreeView->make_iterator();