Class FormulaLocaleNormalizer
The translation is intentionally textual: cell refs, sheet names, function names, and string literals are passed through unchanged. Only the function-argument separator and the decimal mark are rewritten, and only when they actually differ from the US defaults.
- Since:
- 7.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanneedsTranslation(Locale locale) Returnstruewhenlocaleuses non-US separators for either the decimal mark or the function argument list.static StringtoCanonical(String formula, Locale locale) Translatesformulafrom the locale's surface form (e.g.static StringTranslatesformulafrom US-canonical to the locale's surface form.
-
Method Details
-
needsTranslation
Returnstruewhenlocaleuses non-US separators for either the decimal mark or the function argument list. When this returnsfalseboth translation methods are no-ops. -
toCanonical
Translatesformulafrom the locale's surface form (e.g. GermanMAX(0;D$8-($A11+0,5))) to US-canonical (MAX(0,D$8-($A11+0.5))). Returns the input unchanged whenneedsTranslation(Locale)is false.Characters inside double-quoted string literals and inside structured-reference brackets
[...]are preserved verbatim. A,is treated as a decimal point only when it sits between two digits; otherwise it has no canonical role in the locale form (the arg-separator is;). -
toLocale
Translatesformulafrom US-canonical to the locale's surface form. Inverse oftoCanonical(String, Locale). Returns the input unchanged when no translation is needed.Strings and structured-reference brackets are preserved. A
.is rewritten to the locale decimal only when it sits between two digits;,is always the arg separator in the US form and is rewritten to the locale's arg separator.
-