Skip to content

Managing empty i18n local labels #1884

@kbvi

Description

@kbvi

Introduction

Currently on tock, you can use i18ns and translate them depending on a context.

Most of the time, you use consistent values for each locale you want to use, obviously. But it can, yet hardly, happen to have a non consistent value (an empty String) for a quite small piece of sentence for some translation.

That is something you can experiment between french and english depending on the style or editorial format you have to deal with. Some french words are just dropped in english.

For instance:

  1. In french, "Il est né en 1990." (Literally: He was born in 1990.) can be associated in english with "Born in 1990.". In English, we can drop the subject and auxiliary verb, especially in headlines, bios, or quick descriptors. It becomes super concise. In French, though, you can't really omit "Il est" without sounding odd or incomplete — even in headlines or abbreviated formats.
  2. In french, "Since 1995" (Literally: He was born in 1990.) can be associated in english with"Depuis l'année 1995". You can say "Depuis 1995" in French too, and it's acceptable in casual usage (also 2 words), but "Depuis l'année 1995" is more formal or precise, especially in writing or official contexts. In contrast, English almost always just says "Since 1995" — no need for "the year."

Our case

We have just the mention of an hour (variable we treat separately than the i18n label) that is prefixed with preposition "à " in french, but with nothing in english, so potentially "":

  • "à 13h24"
  • "1:24am"

The emerging problem

With our example, we first expected to have respectively in french and english, "à " and "" printed out. But what actually happen is that an empty (or blank) label for a given locale is considered specially: It seems, according to the code, to be considered to be a label without user interface:

//in this context, `this` is the i18n localized label
if (isNullOrBlank()) {
  labelWithoutUserInterface(i18nLabel, defaultLabel, context)
} else {
  this
}

Then labelWithoutUserInterface will compute and yield another value than the empty one detected, which is not profitable in this case.

The issue

On one hand, treating label without user interface seems useful on some cases, but we don't especially need here.
On the other hand, we don't know if our need to render empty localized label has been taken into account, or even legit to consider.

Maybe a feature update is needed or maybe we missed the correct use here. In the latter case, once advised, we can write some more kdoc for future users that tend to use this like us.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions