AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [batch] Compress Russian strings (transliteration) (https://forums.alliedmods.net/showthread.php?t=321587)

Dragokas 02-18-2020 04:09

[batch] Compress Russian strings (transliteration)
 
1 Attachment(s)
Purpose:
Decrease number of bytes of the Russian string by replacing Russian letters by English analogue.

Usefull, e.g. in nicknames or some rare translation phrases cases where buffer size is limited like menus/panels.

Some tip: RU letter is 2 byte, EN - 1 byte.
Script:
Spoiler


Using:
1. Save your string in file "newnames.ini"

2. Unpack:
- ren_script_ANSI.cmd
or
- ren_script_UTF8.cmd

from archive (depending on what txt file codepage you have UTF8 or ANSI)*
- Windows by default create text files in ANSI.
- .phrases.txt is UTF8.

3. Place ren_script_*.cmd next to your text file.

4. Run it (double click).

spumer 02-22-2020 07:45

Re: [batch] Compress Russian strings (transliteration)
 
Hmm. If you have limited buffer size you just can cut nickname, no?

Dragokas 02-22-2020 08:36

Re: [batch] Compress Russian strings (transliteration)
 
Like, cut original nick "Nice Assistant" to "Nice Ass" ? :DDD
No. It depends.
Where you want to preserve original word completely without any cutting, it is a case.

There are lot of use cases. Upcoming examples:
- translation in panel: https://forums.alliedmods.net/showpo...5&postcount=22
- Name changer for bad names: https://github.com/Exle/Auto-Name-Changer
(I'm often fill new names for replacement that exceed the limit. Since I usually create > 20 options it is a lot of text to replace it manually)
- or even if you want to create nickname for yourself that contains russian letters that exceed maximum string size allowed in total.

spumer 02-23-2020 13:31

Re: [batch] Compress Russian strings (transliteration)
 
Quote:

Originally Posted by Dragokas (Post 2684718)
Like, cut original nick "Nice Assistant" to "Nice Ass" ? :DDD
No. It depends.
Where you want to preserve original word completely without any cutting, it is a case.

There are lot of use cases. Upcoming examples:
- translation in panel: https://forums.alliedmods.net/showpo...5&postcount=22
- Name changer for bad names: https://github.com/Exle/Auto-Name-Changer
(I'm often fill new names for replacement that exceed the limit. Since I usually create > 20 options it is a lot of text to replace it manually)
- or even if you want to create nickname for yourself that contains russian letters that exceed maximum string size allowed in total.

Yes, cause you can't compress this nickname cause it have only english symbols.

I mean i actually don't see big problem in cutting, cause in 80% of cases buffer size is big enough.
I knew only one case where i needed smart cutting - vscripting. Buf size for vscript menus is 128 bytes.
For that cases i just wrote algorithm which cut long names and replace ending with dots (...)

Dragokas 02-23-2020 13:58

Re: [batch] Compress Russian strings (transliteration)
 
Quote:

Yes, cause you can't compress this nickname cause it have only english symbols.
lol, that's because if I would write for you Russian example, you can't understand it, or you are speaking Russian?
But if you insist:

here is a name for auto-name-changer:
Code:

setinfo name "Ведьмак Колокольчикус"
it is 41 byte.

Maximum allowed is 31 byte + NULL.

I don't imagine how to cut this nickname without loss of its meaning other than apply transliteration.

spumer 02-27-2020 13:33

Re: [batch] Compress Russian strings (transliteration)
 
It's good try to solve Players problem.
But are you sure it's problem really exists?
In all menus you enough see name part to determine player and apply any action (vote/etc.).

Where did you see the need to show the full name anyway?
And this does not negate the fact that you can specify an even longer name, in the general case, the problem is not completely solved.

Yes, i understand russian. And i have some russian game servers for L4D2.

Dragokas 02-27-2020 14:09

Re: [batch] Compress Russian strings (transliteration)
 
I don't understand what are you trying to explain me.

It is always good to show full name instead of cutted. Ask anybody.
E.g. if my name Stanislav will be auto-cutted to Stanisla, I will not be happy at all.

Quote:

Originally Posted by spumer (Post 2685218)
Where did you see the need to show the full name anyway?

I already told you and gave 2 examples.

Also ++

Here: https://www.dropbox.com/s/l0twg83fhi...names.png?dl=0
And here: https://www.dropbox.com/s/rgjoizx8rf...ames2.png?dl=0

About second: when my server has 16 players, sometimes it is a case for limit of panel buffer.
You can use the same replacement technique in plugin to show full names without need to cut anything.

spumer 02-29-2020 11:20

Re: [batch] Compress Russian strings (transliteration)
 
I don't try explain or teach. I try to understand. Sorry if i disappointed you.

I just have another point of view and now i got what i wanted - "It is always good to show full name instead of cutted.". It's ok and good job for that case.


All times are GMT -4. The time now is 06:10.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.