Add user aliases
This adds an user alias mapping to rooms. The alias can be a custom set one or be generated from a seed. The for generated aliases, an adjective and noun (animal) are selected from localizable word lists. A second, special noun list is used for additional nouns which are selected less often.
User alias can be localized using the messages resource bundle
(messages/messages_<LANG>.yml
). The i18n implementation handles
positioning and gendering of the adjective. For the positioning, a
placeholder is set in the l10n string of the adjective. For gendering,
Java MessageFormat
s choice is used with an enhancement to support
chars instead of just integers values. To determine the correct gender,
it is set as a char (f -> feminine, m -> masculine, n -> neuter) with
each l10n noun string, separated by a pipe symbol.
Example:
alias-nouns:
alpaca: Alpaka|n
alias-adjectives:
adept: Geschickt{1, choice, f#e|m#er|n#es} {0}
This would translate the noun "alpaca" with the adjective "adept" to "Geschicktes Alpaka" in German.
The following localizations are included:
- English (default)
- French
- German
- Spanish
Endpoint:
POST /room/{roomId}/user-alias/-/generate
This generates a new alias or returns an existing one. The response includes the seed, which can be used by the client to persist the generated alias and determine additional properties like coloring. If the alias has been persisted, the response include the entity ID. To persist an alias, the standard entity POST endpoint can be used.
This MR introduces the Guava library which is used to convert a Reader
to
an InputStream
for the YAML resource bundles.
Closes: #238 (closed), #244 (closed)