Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about i18n #29

Closed
dockfries opened this issue Aug 3, 2022 · 1 comment
Closed

about i18n #29

dockfries opened this issue Aug 3, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@dockfries
Copy link
Owner

dockfries commented Aug 3, 2022

Principle

The current situation is that the player chooses the interface language and the system character set on his own, because for sa:mp windows the character set is ansi, depending on the different regions.

The server-side texts are all utf8, and when transmitting to the player, the utf8 is converted into an array of decimal bytes for transmission with the character set chosen by the player.

When the player transmits text data to the server, custom events are also defined by polyfill (see gamemode for details) and passed to the server as decimal byte arrays, which are decoded to utf8 by the server according to the character set chosen by the player.

By now a two-way closed-loop internationalized data transfer has been achieved.

Nickname

See gamemode and #14 for support for multi-byte nicknames.

Note

It is worth noting that:

  1. if the player prefers not to select the correct character set, both the server and the player will receive the text as the wrong character set.
  2. even if the text entered by a player is received by the server as normal in utf8, it will still be garbled if it is sent to another player in a character set that does not support that character. For example, if a player with gbk charset sends to a player with only English charset, the other player will still see the Chinese text is still garbled like '?'.
  3. GameText and TextDraw should always be in accordance with the utf8 character set, because it depends on the character set used by the internationalization modify of the player's client, otherwise it will always display abnormally, and should always be in utf8 format if the omp client supports it in the future.
@dockfries dockfries added the documentation Improvements or additions to documentation label Aug 3, 2022
@dockfries dockfries self-assigned this Sep 27, 2022
Repository owner locked as off-topic and limited conversation to collaborators Oct 7, 2022
Repository owner unlocked this conversation Oct 7, 2022
Repository owner locked as resolved and limited conversation to collaborators Oct 7, 2022
@dockfries dockfries removed their assignment Oct 7, 2022
@dockfries dockfries pinned this issue Feb 14, 2023
@dockfries dockfries unpinned this issue Nov 5, 2023
Repository owner unlocked this conversation Nov 5, 2023
@dockfries dockfries transferred this issue from dockfries/infernus-starter Nov 5, 2023
@dockfries dockfries self-assigned this Nov 5, 2023
@dockfries dockfries pinned this issue Nov 5, 2023
@dockfries
Copy link
Owner Author

dockfries commented Dec 1, 2023

If you are a windows system and there is garbled code when the terminal displays pino logger, you can run the server with the following command.

cmd /c "chcp 65001 > nul & omp-server" in powershell or cmd, which launches a cmd window and temporarily sets the charset to utf8.

Usually, the dev/serve of the terminal under vscode will not garble, because the vscode sets the terminal to be utf8 encoded, so the display is normal.

Although it is more recommended to run directly on linux systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant