Text Manipulation Utilities
The functions in this category are useful for the manipulation of text pre-translation. Note that translating the output of these functions may not work as expected; you will need to supply the output of the function in the .tr
file as the key, rather than the input.
etc.wrap_text
Usage:etc.wrap_text(text, limit[, hard])
A 'smarter' text wrapping function that takes into account the characters in the text and behaves slightly differently depending on the characters around the split point. By default, it will not break words apart. Set
hard
to true in order to allow breaking words.
List of Character Rules
-
: The text will split after the character. If the next character is space it will be removed..
: The text will split after the character. If the next character is space it will be removed.!
: The text will split after the character. If the next character is space it will be removed.?
: The text will split after the character. If the next character is space it will be removed.,
: The text will split after the character. If the next character is space it will be removed.(
: The text will split before the character.
etc.format_as_title
Usage:etc.format_as_title(text[, capitalize_all])
Capitalizes the first letter of each word in a string of text. By default, certain words will not be capitalized unless they appear at the start of the text. setting
capitalize_all
to true disables this behaviour.
List of Words Not Capitalized by Default:
a
an
and
as
at
but
by
for
from
if
in
nor
of
on
or
the
up