11#include <KLocalizedString>
15namespace KUnitConversion
17class RadiansUnitPrivate :
public UnitPrivate
20 RadiansUnitPrivate(CategoryId categoryId,
29 : UnitPrivate(categoryId, id, multiplier, symbol, description, matchString, symbolString, realString, integerString)
33 qreal toDefault(qreal value)
const override
35 return (value / (2 * M_PI)) * 360.0;
37 qreal fromDefault(qreal value)
const override
39 return (value / 360.0) * (2 * M_PI);
43UnitCategory Angle::makeCategory()
45 auto c = UnitCategoryPrivate::makeCategory(AngleCategory,
i18n(
"Angle"),
i18n(
"Angle"));
46 auto d = UnitCategoryPrivate::get(c);
49 d->addDefaultUnit(UnitPrivate::makeUnit(AngleCategory,
52 i18nc(
"angle unit symbol",
"°"),
53 i18nc(
"unit description in lists",
"degrees"),
54 i18nc(
"unit synonyms for matching user input",
"deg;degree;degrees;°"),
56 ki18nc(
"amount in units (real)",
"%1 degrees"),
57 ki18ncp(
"amount in units (integer)",
"%1 degree",
"%1 degrees")));
59 d->addCommonUnit(UnitPrivate::makeUnit(
new RadiansUnitPrivate(AngleCategory,
62 i18nc(
"angle unit symbol",
"rad"),
63 i18nc(
"unit description in lists",
"radians"),
64 i18nc(
"unit synonyms for matching user input",
"rad;radian;radians"),
66 ki18nc(
"amount in units (real)",
"%1 radians"),
67 ki18ncp(
"amount in units (integer)",
"%1 radian",
"%1 radians"))));
69 d->addUnit(UnitPrivate::makeUnit(AngleCategory,
72 i18nc(
"angle unit symbol",
"grad"),
73 i18nc(
"unit description in lists",
"gradians"),
74 i18nc(
"unit synonyms for matching user input",
"grad;gradian;gradians;grade;gon"),
76 ki18nc(
"amount in units (real)",
"%1 gradians"),
77 ki18ncp(
"amount in units (integer)",
"%1 gradian",
"%1 gradians")));
79 d->addCommonUnit(UnitPrivate::makeUnit(AngleCategory,
82 i18nc(
"angle unit symbol",
"'"),
83 i18nc(
"unit description in lists",
"arc minutes"),
84 i18nc(
"unit synonyms for matching user input",
"minute of arc;MOA;arcminute;minute;'"),
86 ki18nc(
"amount in units (real)",
"%1 arc minutes"),
87 ki18ncp(
"amount in units (integer)",
"%1 arc minute",
"%1 arc minutes")));
89 d->addCommonUnit(UnitPrivate::makeUnit(AngleCategory,
92 i18nc(
"angle unit symbol",
"\""),
93 i18nc(
"unit description in lists",
"arc seconds"),
94 i18nc(
"unit synonyms for matching user input",
"second of arc;arcsecond;second;\""),
96 ki18nc(
"amount in units (real)",
"%1 arc seconds"),
97 ki18ncp(
"amount in units (integer)",
"%1 arc second",
"%1 arc seconds")));
QString i18nc(const char *context, const char *text, const TYPE &arg...)
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
QString i18n(const char *text, const TYPE &arg...)