Merging unit skeletons for output - a better way?

Richard Wordingham richard.wordingham at ntlworld.com
Sat May 16 15:03:42 CDT 2020


On Sat, 16 May 2020 15:26:05 +0800
Kip Cole via CLDR-Users <cldr-users at unicode.org> wrote:

> ## Outputting a compound unit (no direct translation, composing is
> required)
> 
> “Kilometer per second” => “{0} kilometers”, “ per “ and “{0} second”
> 
> Now we have three skeletons that need to be merged. Here are the 
> Issues as I see them:
> 
> 1. In order to resolve the skeleton for the denominator “second” I
> take the plural value for “1” (ie always singular form) 2. Ignore the
> placeholder in the denominator so “{0} second” becomes “ second” 3.
> String join the three skeletons 4. Merge the number value into the
> placeholder “{0}” 5. Replace the double space between “per” and
> “second” that arises because there is a trailing space in the “per”
> skeleton and a leading space in the “ second” skeleton

Are we supposed to be able to see how the three elements are joined
together?  The Thai word for 'per' I learnt (ละ) has the numerator and
denominator the opposite way round to English, but I see there is a now
a word (ต่อ) that allows the same order as English. Chinese 每秒三公里
has the syntactic order <per><second><three><kilometer> (source:
Google Translate) 

You haven't accounted for the case of the denominator unit.  It's
accusative in Russian and Polish, e.g. "trzy kilometry na sekundę"
according to Google Translate.  From the same source, Finnish doesn't
use a joining preposition, just the inessive singular on its own.

> PS: In case anyone get this far, the implementation is in the Elixir
> language at https://github.com/elixir-cldr/cldr_units

Would you give us the file names for the generation of the strings?  I'm
not sure it's obvious even if one uses Elixir.

Richard.



More information about the CLDR-Users mailing list