HeyPuter / puter

🌐 The Internet OS! Free, Open-Source, and Self-Hostable.
https://puter.com
GNU Affero General Public License v3.0
24.93k stars 1.61k forks source link

Feedback on Turkish Pluralization - Solution with Vowel Harmony #278

Open hasanbeder opened 5 months ago

hasanbeder commented 5 months ago

Dear Puter Developers, I am writing to provide feedback on the Turkish language support in Puter, specifically regarding the issue of pluralization. Currently, the static "plural_suffix" value does not account for the complexities of Turkish grammar, particularly vowel harmony, leading to inaccuracies.

Proposed Solution: Vowel Harmony-Based Pluralization

Turkish has a vowel harmony system where the vowels within a word must be compatible. This harmony affects the suffixes added to words, including the plural suffix.

1. Identifying Vowel Harmony:

2. Handling Exceptions:

3. Implementation:

Example Code (JavaScript):

function pluralize(word) {
  const lastVowel = word.slice(-1);
  const backVowels = ["a", "ı", "o", "u"];
  const exceptions = {
    diş: "dişler",
    insan: "insan"
    // ... other exceptions
  };

  if (exceptions[word]) {
    return exceptions[word];
  }

  if (backVowels.includes(lastVowel)) {
    return word + "lar";
  } else {
    return word + "ler";
  }
}

I believe that implementing a vowel harmony-based pluralization system will greatly enhance the quality of Puter's Turkish language support.

Sincerely.

AtkinsSJ commented 5 months ago

Every language has its own different way of handling plurals, with its own exceptions. I would personally suggest we try something similar to Android's quantity strings. Then, the translator just writes the different cases themselves, and the software doesn't need to know anything about grammar.

KernelDeimos commented 5 months ago

+1 on a pluralize function, but exceptions should be in the language's data file rather than the function itself. I think each language having it's own (optional) pluralize function as a fallback for manual entries is a pretty neat idea. This is effectively a hybrid of the two options that were proposed here.