Daniel Muey
and 1 contributors

Normalization

Turn markup related characters into bracket notation.

Rationale

Allowing markup characters in the phrase is problematic for a number of reasons, including:

  • Markup only makes sense in one context.

  • Their presence could unpredictably break markup or other syntax.

  • Translators are likely to unwittingly change/break markup unless you take extra precautions (e.g. more <ph> handling of text/html ctype in XLIFF, yikes!).

  • Markup could also make the translatable part harder for them to translate.

  • Allowing markup encourages using your phrase as a template/branding/theming system which is a really terrible idea.

  • if we don’t use them, even in chr() it is less problem prone since bracket notation allows to do things correctly in each context

So we detect and modify them.

IF YOU USE THIS FILTER ALSO USE …

… THIS FILTER Locale::Maketext::Utils::Phrase::Norm::Ampersand.

This is not enforced anywhere since we want to assume the coder knows what they are doing.

possible violations

Turns <>'" into appropriate bracket notation.

& is handled in its own driver.

possible warnings

consider if, instead of using straight double quotes, using “” is the right thing here (i.e. instead of bracket notation)

This is issued when " is encountered.

consider if, instead of using a straight apostrophe, using ‘’ for single quoting and ’ for an apostrophe is the right thing here (i.e. instead of bracket notation)

This is issued when ' is encountered.