News for hackers. Stuff that matters.
Re:"Your" vs. "My" in user interfaces by GLdRH on Tuesday September 16, 2025 @05:10AM (#45259873)
At the risk of driving you up the wall, but please explain
Re:"Your" vs. "My" in user interfaces by edgsousa on Tuesday September 16, 2025 @05:14AM (#45259891)
One simple example is slavic languages where you have different forms of plural depending on the number.
Re:"Your" vs. "My" in user interfaces by Groxx on Tuesday September 16, 2025 @05:34AM (#45260042)
pluralization is much MUCH more complex in many languages than in English: https://www.unicode.org/cldr/charts/47/supplemental/language...

it can largely be turned into six categories of behavior, with tons of languages choosing different boundaries for those categories. ios/osx and android have tools for this, and probably others (I'm just personally familiar with these).

and even English isn't even that simple in the way many treat it - you don't pluralize sentences, parts of sentences change in contrast to each other (a car drives vs cars drive). so e.g. widely used APIs like https://apidock.com/rails/v7.1.3.4/String/pluralize are blatantly misleading merely by existing, and it leads to mistakes in many (most?) languages, and also English, even though the authors of the API speak English.

Re:"Your" vs. "My" in user interfaces by ViscountPenguin on Tuesday September 16, 2025 @06:55AM (#45260564)
That has to be one of the most cursed functions that I've heard of in my life. Anything less than a call to ChatGPT is doomed to fail.
Re:"Your" vs. "My" in user interfaces by Muromec on Thursday September 18, 2025 @12:57PM (#45292037)
It is a solved problem with tools that help to do it right, but nobody does it right. People wrote that cursed function for every language long time ago, but you as a developer need to know it exists and use it
Re:"Your" vs. "My" in user interfaces by Groxx on Friday September 19, 2025 @01:10PM (#45304013)
yeah, I mean `toUpper(string)` exists in basically every language and it's equally cursed. it's nothing even slightly new, just another sigh-inducer when you see people using it.
Re:"Your" vs. "My" in user interfaces by eloisant on Tuesday September 16, 2025 @08:53AM (#45261565)
Making it plural doesn't always mean "replace one word by another".

The right thing to do it:

add_one = "Add one thing" add_multiple = "Add {n} things"

Then you'll provide the full sentence for each language. Of course some languages will need more cases, like slavic language where it's 1, 2-4, 5+, so depending on the languages you need to support you need to put more than 2 strings.

Re:"Your" vs. "My" in user interfaces by Illniyar on Tuesday September 16, 2025 @09:08AM (#45261735)
Not the parent, but you use a translation format like `translations("INVITE_USER", {gender_of_host, num_guests})`

Then you will have an algorithm that knows to translate based on some rules - like the ICU messages format - https://unicode-org.github.io/icu/userguide/format_parse/mes...

In the link there's an example of how such rules look like (they'll be different for each language)

Re:"Your" vs. "My" in user interfaces by smnrchrds on Tuesday September 16, 2025 @10:16AM (#45262566)
For example, in Arabic, nouns have three forms: singular, dual, and plural. Dual and plural are not interchangeable.
Re:"Your" vs. "My" in user interfaces by sznio on Thursday September 18, 2025 @04:48AM (#45287215)
Polish has different plurals for [2:4],[5:21], then [2n+2 : 2n+4], [2n+5 : 2n+11], restarting at 2n = 100

1 osoba

2, 3, 4 osoby

5, 6, 15, 21 osób

22 osoby

25 osób

101, 112 osób