LibreOffice Module svtools (master) 1
collatorres.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <svtools/svtresid.hxx>
21#include <svtools/strings.hrc>
23
24// implementation of the collator-algorithm-name translation
26{
27 m_aData.emplace_back("alphanumeric", SvtResId(STR_SVT_COLLATE_ALPHANUMERIC));
28 m_aData.emplace_back("charset", SvtResId(STR_SVT_COLLATE_CHARSET));
29 m_aData.emplace_back("dict", SvtResId(STR_SVT_COLLATE_DICTIONARY));
30 m_aData.emplace_back("normal", SvtResId(STR_SVT_COLLATE_NORMAL));
31 m_aData.emplace_back("pinyin", SvtResId(STR_SVT_COLLATE_PINYIN));
32 m_aData.emplace_back("radical", SvtResId(STR_SVT_COLLATE_RADICAL));
33 m_aData.emplace_back("stroke", SvtResId(STR_SVT_COLLATE_STROKE));
34 m_aData.emplace_back("unicode", SvtResId(STR_SVT_COLLATE_UNICODE));
35 m_aData.emplace_back("zhuyin", SvtResId(STR_SVT_COLLATE_ZHUYIN));
36 m_aData.emplace_back("phonebook", SvtResId(STR_SVT_COLLATE_PHONEBOOK));
37 m_aData.emplace_back("phonetic (alphanumeric first)", SvtResId(STR_SVT_COLLATE_PHONETIC_F));
38 m_aData.emplace_back("phonetic (alphanumeric last)", SvtResId(STR_SVT_COLLATE_PHONETIC_L));
39}
40
41const OUString& CollatorResource::GetTranslation(const OUString& r_Algorithm)
42{
43 sal_Int32 nIndex = r_Algorithm.indexOf('.');
44 OUString aLocaleFreeAlgorithm;
45
46 if (nIndex == -1)
47 {
48 aLocaleFreeAlgorithm = r_Algorithm;
49 }
50 else
51 {
52 nIndex += 1;
53 aLocaleFreeAlgorithm = r_Algorithm.copy(nIndex);
54 }
55
56 for (size_t i = 0; i < m_aData.size(); ++i)
57 {
58 if (aLocaleFreeAlgorithm == m_aData[i].GetAlgorithm())
59 return m_aData[i].GetTranslation();
60 }
61
62 return r_Algorithm;
63}
64
65/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< CollatorResourceData > m_aData
Definition: collatorres.hxx:48
const OUString & GetTranslation(const OUString &rAlgorithm)
Definition: collatorres.cxx:41
sal_Int32 nIndex
int i
OUString SvtResId(TranslateId aId)
Definition: svtresid.cxx:24