News for hackers. Stuff that matters.
Re:The kind of company I want to be a part of by ChrisMarshallNY on Tuesday November 11, 2025 @11:23AM (#45889137)
What I do, is have two different formats in the translation tokens.

As an example, this app[0], is currently only localized in English, but I still use tokens, whenever I do apps, so the base localization[1] has stuff like this:

    "SLUG-CLEANTIME-DIVIDER"                        =   "\nThis is ";
    "SLUG-PREFIX-CLEANTIME-YEAR-EXACT"              =   "exactly one year.";
    "SLUG-PREFIX-CLEANTIME-YEARS-EXACT"             =   "exactly %d years.";
    "SLUG-PREFIX-CLEANTIME-YEAR"                    =   "one year";
    "SLUG-PREFIX-CLEANTIME-YEARS"                   =   "%d years";
    "SLUG-PREFIX-CLEANTIME-MONTH"                   =   "one month";
    "SLUG-PREFIX-CLEANTIME-MONTHS"                  =   "%d months";
    "SLUG-PREFIX-CLEANTIME-DAY"                     =   "one day";
    "SLUG-PREFIX-CLEANTIME-DAYS"                    =   "%d days";
Which is actually composed in this dependency[2].

It's not perfect, but is pretty flexible.

Silly stuff, I know, and the app is not exactly a viral sensation, but the folks that use it, like it.

[0] https://apps.apple.com/us/app/nacc/id452299196

[1] https://github.com/LittleGreenViper/NACC/blob/master/Sources...

[2] https://github.com/LittleGreenViper/LGV_UICleantime/blob/mas...

Re:The kind of company I want to be a part of by 317070 on Tuesday November 11, 2025 @12:30PM (#45890235)
From the little Ukrainian I know, I do know that they have 3 forms for the word year ("рік" pronounced r-ee-k). There is one that matches the English singular "рік" (but you'd also use it for e.g. 21 years), and there is one "роки" which is used for quantities 2, 3 and 4 (but also 22, 23 and 24) and another plural form "років" for the other quantities. [0]

So, the few lines of the localisation you posted don't work for Ukrainian and most other Slavic languages.

And that is the issue! Languages differ a lot in ways that are hard to catch in code. And it is the issue leading to for instance "blob(s)" in localised applications, as a lot of languages don't even have a plural, such as Mandarin.

[0] https://translate.google.com/?sl=en&tl=uk&text=1%20year%20ol...

Re:The kind of company I want to be a part of by angiolillo on Tuesday November 11, 2025 @01:34PM (#45891047)
If you're curious about the rules for various languages, I find https://cldr.unicode.org/index/cldr-spec/plural-rules to be a helpful refence.
Re:The kind of company I want to be a part of by ChrisMarshallNY on Tuesday November 11, 2025 @03:15PM (#45892234)
That's useful! Thanks!

Looks like, if I wanted to be pedantic, I'd have to add a separate one for 2.

Re:The kind of company I want to be a part of by ChrisMarshallNY on Tuesday November 11, 2025 @12:44PM (#45890401)
Like I said, not perfect, but you might want to look more closely.

Note that the only format placeholder is an integer. You can use whatever words you want, around that integer.

If you have a singular, then you use one of the singular tokens (no integer).

I found this to be the most flexible approach.