1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2008 Chusslove Illich <caslav.ilic@gmx.net>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef COMMON_HELPERS_P_H
9#define COMMON_HELPERS_P_H
10
11#include <QLocale>
12#include <QString>
13
14// Standalone (pure Qt) functionality needed internally in more than
15// one source file on localization.
16
17/**
18 * @internal
19 *
20 * Removes accelerator marker from a UI text label.
21 *
22 * Accelerator marker is not always a plain ampersand (&),
23 * so it is not enough to just remove it by @c QString::remove().
24 * The label may contain escaped markers ("&&") which must be resolved
25 * and skipped, as well as CJK-style markers ("Foo (&F)") where
26 * the whole parenthesis construct should be removed.
27 * Therefore always use this function to remove accelerator marker
28 * from UI labels.
29 *
30 * @param label UI label which may contain an accelerator marker
31 * @return label without the accelerator marker
32 */
33QString removeAcceleratorMarker(const QString &label);
34
35/**
36 * @internal
37 *
38 * Returns the date format used for the locale with the year as a four digit
39 * number.
40 *
41 * If the date format used for the locale already has a 4-digit year, then
42 * this is the same as locale.dateFormat(format). Otherwise, it's the result
43 * of QLocale::dateFormat with "yy" replaced with "yyyy".
44 * In particular when using the short format for date inputs you may want to
45 * use the short format with 4-digit year because Qt parses current 2-digit year
46 * values like 22 as 1922.
47 *
48 * @param locale The locale that you want the date format for.
49 * @param format The date format that you want.
50 * @return the date format string with 4-digit year
51 */
52QString dateFormatWith4DigitYear(const QLocale &locale, QLocale::FormatType format);
53
54#endif
55

source code of kwidgetsaddons/src/common_helpers_p.h