edubart / otclient

An alternative tibia client for otserv written in C++11 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
Other
652 stars 399 forks source link

[Suggestion] Better way of handling locales #1061

Open Zbizu opened 4 years ago

Zbizu commented 4 years ago

Hi everyone,

I want to suggest a more clear way of handling language strings in the client, something that would make translations / language edits easier to create.

Problem:

Solution I propose:

English language sheet would be the template with translations filled like other languages, this way:

  translation = {
    ["staminaTimeLeft"] = "You have %s hours and %s minutes left",
  }

and translation priority would be:

Pros:

Cons:

lolima commented 4 years ago

It's the same concept used by Babel for Angular/React. Each language has a .json file and there's an additional software that helps translating them simultaneously.

slawkens commented 3 years ago

The problem with this concept is, that it's impossible to constantly invent new keys for specific texts, because it has limited length.

Laravel (PHP Framework) has good documentation on this: https://laravel.com/docs/8.x/localization#using-translation-strings-as-keys

I will quote it here:

For applications with a large number of translatable strings, defining every string with a "short key" can become confusing when referencing the keys in your views and it is cumbersome to continually invent keys for every translation string supported by your application.

So saying short: if application has large number of translatable strings (like OTClient has), it will be painful to define every translation as key.

I understand your solution to the problem, but I am against making it as a standard way of handling localisation in OTClient.

Edit

I actually looked at translation strings and they don't seem to be big. The OtClient itself is big app, but the strings itself not.

So your idea seems reasonable. You have convinced me.