1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svtools/svtresid.hxx>
21 #include <svtools/strings.hrc>
22 #include <svtools/collatorres.hxx>
24 // implementation of the collator-algorithm-name translation
25 CollatorResource::CollatorResource()
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
));
41 const OUString
& CollatorResource::GetTranslation(const OUString
& r_Algorithm
)
43 sal_Int32 nIndex
= r_Algorithm
.indexOf('.');
44 OUString aLocaleFreeAlgorithm
;
48 aLocaleFreeAlgorithm
= r_Algorithm
;
53 aLocaleFreeAlgorithm
= r_Algorithm
.copy(nIndex
);
56 for (size_t i
= 0; i
< m_aData
.size(); ++i
)
58 if (aLocaleFreeAlgorithm
== m_aData
[i
].GetAlgorithm())
59 return m_aData
[i
].GetTranslation();
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */