Skip to content

Avoid construcrion of sentences using single words in the localization files. #712

@RamzArzFarsi

Description

@RamzArzFarsi

These are some of the lines between 442 and 456 in the locales/en.yaml file:

442 selling: Selling
443 buying: Buying
446 is: is
456 sats: sats

When a user sets /showusername yes and creates an order, the words above are used to construct a sentence based on the order type.

@username is Buying sats
@username is Selling sats

The problem: Not every language uses the same order of words in a sentence as English.

Some languages might even need a different number of words to write the same sentence. For example, the Persian language is written from right to left (rtl), and it is only shown correctly when

text-align: right;
direction: rtl;

The text alignment and direction in a message are set automatically by Telegram for each line, and Telegram's criteria for whether it should use rtl or ltr for a line is the very first character at the beginning of that line. If the first character is from the alphabet of an rtl language, the entire line is shown rtl and if it is from the alphabet of an ltr language, then the entire line becomes ltr.

If we strictly translate the sentence "@username is Buying sats" then the line will be an ltr one because the username cannot be translated and "@" is an ltr character.
A common workaround in these scenarios is adding an extra Persian word at the start of the translated sentence that is not found in the original sentence but also won't change the meaning. For example:
User @username is Buying sats

Now our translated sentence will begin with "کاربر" (the Persian word for "User") and trigger rtl direction for the entire line, causing the rest of the sentence to be shown correctly while maintaining the same meaning as the original sentence.

Implementing this workaround is currently not possible due to how the strings are structured.

Suggestion:
Get rid of all the mentioned one-word strings and add these two instead:

showusername_buy: '@${username} is buying sats'
showusername_sell: '@${username} is selling sats'

These give the translators much more flexibility to come up with a natural-sounding translation for the native speakers of their language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions