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

Solved Translation phrase not found only in player loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Azzod
Junior Member
Join Date: Nov 2016
Location: France
Old 06-22-2021 , 11:14   Translation phrase not found only in player loop
Reply With Quote #1

Hello,

I have a problem with translations.
My plugin is like that :

Code:
public void OnPluginStart() {     // ...     LoadTranslations("csacademie.phrases"); }   public Action OnRate(int client, int args) {        launchPanel(client); }   startRate() {     int i;         for (i = 1; i <= MaxClients; i++) {         if (IsClientInGame(i)) {             launchPanel(i);         }     } }   launchPanel(int client) {     if (!IsClientInGame(client) || IsFakeClient(client)) {         return;     }         Menu menu = new Menu(MenuHandler);     menu.SetTitle("%T", "csgo_maprate.question", client); }

The problem, is when I pass in the "startRate" function.
The loop fails after 5 or 6 times, and give me an error : "Exception reported: Language phrase "csgo_maprate.question" not found (arg 5)" (In the launchPanel function at menu.SetTitle)

The firsts players receive the panel menu. If I pass with the "OnRate" function, the panel working too.

Anyone have an idea what I'was wrong doing?

Passing with the Format function have the same result
__________________
French CSGO fun server : https://csacademie.fr

Last edited by Azzod; 06-23-2021 at 16:12.
Azzod is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-22-2021 , 17:00   Re: Translation phrase not found only in player loop
Reply With Quote #2

Quote:
Originally Posted by Azzod View Post
Hello,
The loop fails after 5 or 6 times, and give me an error : "Exception reported: Language phrase "csgo_maprate.question" not found (arg 5)" (In the launchPanel function at menu.SetTitle)
The error seems not related to published code, there is no arg # 5.
Show:
- full code.
- full translation file.
- full error message.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 06-22-2021 , 17:00   Re: Translation phrase not found only in player loop
Reply With Quote #3

Not sure but maybe should be "%t" instead of "%T"
Still, I don't remember if SetTitle allows inline translations (never tried)
Anyway, you should share your csacademie.phrases file aswell.
__________________
Marttt is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-22-2021 , 17:04   Re: Translation phrase not found only in player loop
Reply With Quote #4

Marttt, %t is only for functions, allowing to pass "client" as the first argument.
His snippet is correct.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-22-2021 , 17:20   Re: Translation phrase not found only in player loop
Reply With Quote #5

Also, what is your "ServerLang" value in addons/sourcemod/configs/core.cfg ?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Azzod
Junior Member
Join Date: Nov 2016
Location: France
Old 06-23-2021 , 02:19   Re: Translation phrase not found only in player loop
Reply With Quote #6

Quote:
Originally Posted by Dragokas View Post
The error seems not related to published code, there is no arg # 5.
Show:
- full code.
- full translation file.
- full error message.
Hello,
Thank for your response.

Full code can be see here: https://pastebin.com/Pm2NeWKs (Just tested with "menu.SetTitle("%t", "csgo_maprate.question");" , working too with only one call, but not with the loop.)

For full translations : https://pastebin.com/TBPpWx9E

Full error :
Code:
L 06/22/2021 - 23:57:13: Info (map "de_lastbreath") (file "/home/disk1/servers/csgo_server/csgo/addons/sourcemod/logs/errors_20210622.log")
L 06/22/2021 - 23:57:13: [SM] Exception reported: Language phrase "csgo_maprate.question" not found (arg 4)
L 06/22/2021 - 23:57:13: [SM] Blaming: csgo_maprate.smx
L 06/22/2021 - 23:57:13: [SM] Call stack trace:
L 06/22/2021 - 23:57:13: [SM]   [0] Menu.SetTitle
L 06/22/2021 - 23:57:13: [SM]   [1] Line 87, d:\projects\csacademie-plugins\fun\csgo_maprate.sp::launchPanel
L 06/22/2021 - 23:57:13: [SM]   [2] Line 151, d:\projects\csacademie-plugins\fun\csgo_maprate.sp::startRate
L 06/22/2021 - 23:57:13: [SM]   [3] Line 58, d:\projects\csacademie-plugins\fun\csgo_maprate.sp::onRoundPreEnd
Quote:
Also, what is your "ServerLang" value in addons/sourcemod/configs/core.cfg ?
ServerLang is configured with "en".

So, I will check to add the "en" translation (I can't now, but this night).
The sourcemod serverLang is the fallback locale even the plugin translation doesn't exist yet ?
__________________
French CSGO fun server : https://csacademie.fr
Azzod is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-23-2021 , 07:36   Re: Translation phrase not found only in player loop
Reply With Quote #7

It is a language code used by default when you ask to translate phrase on client's language which doesn't exist in your translation file.
Since "en" phrases also doesn't exist in your file, it throws the above error.

I strongly don't recommend to change "ServerLang" to something else.
Yeah, just add "en" variants.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Azzod
Junior Member
Join Date: Nov 2016
Location: France
Old 06-23-2021 , 16:12   Re: Translation phrase not found only in player loop
Reply With Quote #8

Just tested with "en" translation, and working fine!
Thank you for help !
__________________
French CSGO fun server : https://csacademie.fr
Azzod is offline
Reply


Thread Tools
Display Modes

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 04:23.


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