Raised This Month: $51 Target: $400
 12% 

print in another lang


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
newone123
Junior Member
Join Date: May 2021
Old 05-15-2021 , 19:04   print in another lang
Reply With Quote #1

i have string with non-eng words.
when i print its reversing the words, how i can display correctly ?

if its help i read from json with: json_object_get_string() func (the words that i want)
and print with: client_print(0, print_chat, "[%s")
newone123 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-15-2021 , 23:56   Re: print in another lang
Reply With Quote #2

Quote:
Originally Posted by newone123 View Post
when i print its reversing the words
What does that mean? Please show an example of the input (presumable your file) and the output (what you see in chat).
__________________
fysiks is offline
newone123
Junior Member
Join Date: May 2021
Old 05-16-2021 , 10:43   Re: print in another lang
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
What does that mean? Please show an example of the input (presumable your file) and the output (what you see in chat).
https://pasteboard.co/K2aDscB.png
newone123 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-16-2021 , 15:42   Re: print in another lang
Reply With Quote #4

Attach the plugin and JSON file so that we can see and test the code.
__________________
fysiks is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 05-17-2021 , 12:47   Re: print in another lang
Reply With Quote #5

maybe it happens because of Hebrew symbols?

Last edited by kww; 05-17-2021 at 12:47.
kww is offline
newone123
Junior Member
Join Date: May 2021
Old 05-17-2021 , 14:22   Re: print in another lang
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Attach the plugin and JSON file so that we can see and test the code.
I think its really unrelated because eng it reads excellent hebrew not.
after i get json file and read it
Code:
public read() {
	new JSON:decodingJson = json_parse("/addons/java/alerts.json", true)
	if(json_is_array(decodingJson)) {
		new JSON:firstObj = json_array_get_value(decodingJson, 0)
		if(firstObj) {
			new cityKey[] = "data", dateKey[] = "alertDate"
			new vcity[101], vdate[101]
			new ok = 0
			if(json_object_get_string(firstObj, cityKey, vcity, charsmax(vcity))) ok++
			else client_print(0, print_chat, "[AMX] cant get the city by key = %s", vcity)
			if(json_object_get_string(firstObj, dateKey, vdate, charsmax(vdate))) ok++
			else client_print(0, print_chat, "[AMX] cant get the date by key = %s", vdate)
			if(ok == 2) {
				new ocity [101], odate[101] 
				get_pcvar_string(cvar_City, ocity, charsmax(ocity))
				get_pcvar_string(cvar_Date, odate, charsmax(odate))
				if(!equal(ocity, vcity) || !equal(odate, vdate)) {
					client_print(0, print_chat, "[AMX] alert %s under attack!", vcity)
					set_pcvar_string(cvar_City, vcity)
					set_pcvar_string(cvar_Date, vdate)
					client_cmd(0, "spk %s", "/addons/java/alert.wav")
				} else client_print(0, print_chat, "[AMX] the last attack was in  %s ", vcity)
			}
			json_free(firstObj)
		} else client_print(0, print_chat, "[AMX] cant load first object")
		json_free(decodingJson)
	} else client_print(0, print_chat, "[AMX] json file not readable")
}
the json file that i received from curl (just few lines):
Code:
[{"alertDate":"2021-05-16 18:49:19","title":"התרעות פיקוד העורף","data":"אורים"},{"alertDate":"2021-05-16 18:49:17","title":"התרעות פיקוד העורף","data":"מגן"},{"alertDate":"2021-05-16 18:49:17","title":"התרעות פיקוד העורף","data":"ניר עוז"},{"alertDate":"2021-05-16 18:49:17","title":"התרעות פיקוד העורף","data":"עין הבשור"},{"alertDate":"2021-05-16 18:42:40","title":"התרעות פיקוד העורף","data":"ארז"},{"alertDate":"2021-05-16 18:27:55","title":"התרעות פיקוד העורף","data":"כיסופים"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"אזור תעשייה עד הלום"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"אמונים"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"בית עזרא"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"גבעתי"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"ניצן"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"עזר"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"עזריקם"},{"alertDate":"2021-05-16 18:18:00","title":"התרעות פיקוד העורף","data":"שדה עוזיהו"},{"alertDate":"2021-05-16 18:17:25","title":"התרעות פיקוד העורף","data":"אשדוד - א,ב,ד,ה"},{"alertDate":"2021-05-16 18:17:25","title":"התרעות פיקוד העורף","data":"אשדוד - ג,ו,ז"},{"alertDate":"2021-05-16 18:17:25","title":"התרעות פיקוד העורף","data":"אשדוד - ח,ט,י,יג,יד,טז"},{"alertDate":"2021-05-16 18:17:25","title":"התרעות פיקוד העורף","data":"שתולים"},{"alertDate":"2021-05-16 18:17:24","title":"התרעות פיקוד העורף","data":"אשדוד - יא,יב,טו,יז,מרינה"},{"alertDate":"2021-05-16 18:17:18","title":"התרעות פיקוד העורף","data":"בת הדר"},{"alertDate":"2021-05-16 18:17:18","title":"התרעות פיקוד
newone123 is offline
newone123
Junior Member
Join Date: May 2021
Old 05-17-2021 , 14:23   Re: print in another lang
Reply With Quote #7

Quote:
Originally Posted by kww View Post
maybe it happens because of Hebrew symbols?
im know its because non eng lan, and how did you know its heb lol ?
newone123 is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 05-17-2021 , 14:55   Re: print in another lang
Reply With Quote #8

Quote:
Originally Posted by newone123 View Post
im know its because non eng lan
not really. You can use any language that is not written from right to left and it will have the usual spelling, otherwise it will be distorted like in your screenshot

Quote:
Originally Posted by newone123 View Post
how did you know its heb lol ?
just saw familiar characters

Last edited by kww; 05-17-2021 at 14:58.
kww is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-17-2021 , 23:43   Re: print in another lang
Reply With Quote #9

Unfortunately, I'm unable to test this (and I'm not familiar with how computers handle RTL languages) because apparently my game doesn't use a font that supports Hebrew so I don't see anything in-game. My first guess would be that maybe the game can't handle RTL and LTR languages being mixed in a single line (I'm not even entirely sure it handles RTL at all but I assume it does). What happens if the only text being printed is RTL (Hebrew), with and without the data provided by the JSON (I doubt it has anything to do with the JSON file itself).
__________________
fysiks is offline
newone123
Junior Member
Join Date: May 2021
Old 05-18-2021 , 00:27   Re: print in another lang
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
Unfortunately, I'm unable to test this (and I'm not familiar with how computers handle RTL languages) because apparently my game doesn't use a font that supports Hebrew so I don't see anything in-game. My first guess would be that maybe the game can't handle RTL and LTR languages being mixed in a single line (I'm not even entirely sure it handles RTL at all but I assume it does). What happens if the only text being printed is RTL (Hebrew), with and without the data provided by the JSON (I doubt it has anything to do with the JSON file itself).
I thought so (not related to json)
heb its write from right to left
eng write from left to right
i think this is the problem
there any way use reverse loop on the string even char by char and make it right ?
newone123 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:43.


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