Make a cyrillic chat...
Afijak
Join Date: 2013-09-16 Member: 188281Members
So a proposition is like that in the title - how about to make a switch language option ("Shift+Alt" like in Windows) to make possible cyrillic typing in the ingame chat (for example in russian)?? I dont use microphone and often use russian servers (because im a native russianspeaker) and lack of cyrillic symbols is a trouble for me...
Comments
Good idea.
1) A basic approach would only allow entering lowercase (or only uppercase) letters as scancodes are on lower level than Shift/CapsLock modifiers. It would require special handling of Shift key instead of offloading this task to the OS. But that's quite negligible.
2) The main problem is that OnSendCharacterEvent receives rather a cryptic data instead of a character. It looks like "userdata 0x8192abcd" (i.e. a hexadecimal number). Then it gets to GUIChat:SendCharacterEvent (at GUIChat.lua) where it's being converted to an actual one-character string and added to the chat GUI control. The conversion is also kinda hacky (actually, ugly), it's at Utility.lua and called ConvertWideStringToString(). It creates a GUI item (probably, some base class for all GUI elements), uses SetWideText() on it and then gets the contents as text via GetText(). Why use a GUI element when you can export an engine function directly with less overhead? Anyway, we can't craft such a structure from lua because it's a special data type that can't be accessed from scripts. It's an ideal black box. Period.
Okay, there IS a way to enter cyrillics, I think. For example, there can be a special internal layout flag that, if set, translates entered latin chars into corresponding cyrillics. For example, a user type "ghbdtn", the chat decodes it into "привет" using a simple char replacement according to the layout. Though these chars would be invisible anyway for Linux players (that's another issue). But it's worth a try.
Overall, the problem is that the engine doesn't call OnSendCharacterEvent() if the layout is not English. This particular issue seems to be impossible to fix from just lua.
Just wait for the next patch currently the engine uses as std locale only "en_US" which is just the basic ASCII charset, we changed that for 273 to "en_US.utf"8 and so far all playtesters reported that their issues with non ascii keys are gone (same for the linux issue of displaying those chars).
The only issue left would be that the lua key map is still only ASCII and therefor non ASCII keys have weird name in the the option menu (like Key #367) but that shouldn't be a large issue.
Indeed.
P.S. I'll hack my little mod anyway, it's already working actually.
...or whatever the resulting .so library is called.
Magically, it enables unicode and all non-ASCII symbols become visible in chat as well as the game now allows typing them. This will also enable localizations for all languages:
Your guide is designed for experienced users, and yet it does not say that the library libnvidiathing.so to compile on x32 system
Инструкция для x32-битных Linux систем.
Чтобы корректно руссифицировать Natural Selection 2, нужно.
1. Перейти в раздел вашей игры (например у меня /.steam/steam/steamapps/common/Natural Selection 2/)
2. Создать файл preload.c, в нем вставить текст 3. Создать файл Makefile, в нем вставить текст 4. В текущей директории открыть терминал и ввести следующие команды:
gcc -fPIC -c -o preload.o preload.c
gcc -shared -o preload.so preload.o -ldl
make Makefile all
5. В Steam в Библиотеке выбрать Natural Selection 2 -> Свойства -> Установить параметры запуска и ввести
LD_PRELOAD=$LD_PRELOAD:libnvidiathing.so %command%
В игре в Настройках выбрать Русский
But anyway this hint (or "guide") gets outdated very fast, build 273 was announced to be released today and it should include the locale fix.
Also, you don't need to execute this: It's done via Makefile, and in this form (without -m32) it will produce a 64-bit library named "preload.so" which you don't use afterwards.
"make Makefile all" can be replaced with just "make".
That said, I understand your frustration and I don't mock you. I'm glad you were able to figure it all out.
huh