Jump to content
Sign in to follow this  
Cheitan

Using stringtables in description.ext

Recommended Posts

Hey folks.

I'm struggling with some strange behaviour here. I'm trying to use the very cool notification system (BIS_fnc_showNotification) with some localized text so several languages can be added to my scripts. I have defined my notifications as follow (sample) :

class CfgNotifications
{
	class SubmarineOk
	{
		title = "GSRI Insertion System";
		iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIconDone_ca.paa";
		iconText = "";
		description = $STR_GSRI_submarineOk;
		color[] = {1,1,1,1};
		duration = 5;
		priority = 0;
		difficulty[] = {};
	};
};

And my stringtable.xml is structured as fllow (sample also) :

<?xml version="1.0" encoding="UTF-8"?>
<Project name="GSRI Opex Template">
	<Package name="GSRI_opex_Submarine">
		<Key ID="STR_GSRI_submarineOk">
			<Original>Submarine has moved to the designated location (%1).</Original>
			<French>Le sous-marin s'est déplacé aux coordonnées indiquées (%1)</French>
		</Key>
	</Package>
</Project>

However, when trying to activate the corresponding action, the notification is displayed with no text at all. Trying to use *localize "STR_GSRI_SubmarineOk"* is returning an empty string. This behavior is witnessed in both 3den preview and packed pbo launched on my computer. Following an advice from Dedmen I've checked if the stringtable.xml file was correctly added to the mission pbo and yes, it is.

EDIT : the game is adding a log entry in RPT : "19:05:51 String STR_GSRI_submarineOk not found"

 

Any idea ?

Edited by Cheitan
Add new intel

Share this post


Link to post
Share on other sites

OK, I think my game is cursed, or something. Here is my full Stringtable.xml file :
 

<?xml version="1.0" encoding="UTF-8" ?>
<Project name="GSRI_Opex_Template">
	<Package name="GSRI_opex_notifications">
		<Key ID="STR_GSRI_submarineOk">
			<Original>Submarine has moved to the designated location (%1).</Original>
			<French>Le sous-marin s'est déplacé aux coordonnées indiquées (%1).</French>
		</Key>
		<Key ID="STR_GSRI_submarineFail">
			<Original>Submarine cannot go here.</Original>
			<French>Le sous-marin ne peux se déplacer ici.</French>
		</Key>
		<Key ID="STR_GSRI_submarineInfo">
			<Original>Left-click to move, shift+click to move in surface.</Original>
			<French>Clic-gauche pour déplacer, maj+clic pour déplacer à la surface.</French>
		<Key>
		<Key ID="STR_GSRI_heliInfo">
			<Original>%1 is available in hangar.</Original>
			<French>%1 est disponible dans le hangar.</French>
		</Key>
		<Key ID="STR_GSRI_heliDelete">
			<Original>%1 has been deleted.</Original>
			<French>%1 a été supprimé.</French>
		</Key>
		<Key ID="STR_GSRI_heliMoved">
			<Original>%1 has been moved.</Original>
			<French>%1 a été déplacé.</French>
		<Key>
		<Key ID="STR_GSRI_heliFRIES">
			<Original>%1 is now equipped with FRIES.</Original>
			<French>%1 a été équipé d'un FRIES.</French>
		<Key>
	</Package>
</Project>

Initially it was split between two packages for the sake opf clarity, but while trying to debug it all I ended up with this simplified form. But now I don't understand a thing to what I'm seeing...

When calling _localize "STR_GSRI_submarineOk", the right sentence is displayed.
When calling _localize "STR_GSRI_submarineFail", the right sentence is displayed.
When calling _localize "STR_GSRI_submarineInfo", the sentence displayed sentence is " is available in hangar".
When calling _localize "STR_GSRI_heliInfo", no sentence is found.
When calling _localize "STR_GSRI_heliDelete", no sentence is found.
When calling _localize "STR_GSRI_heliMoved", no sentence is found.
When calling _localize "STR_GSRI_heliFRIES", no sentence is found.

 

Moreover, my game is supposed to be configured for french language, so even if there were a bug with, let's say, encoding, the right sentence should be " est disponible dans le hangar" instead of the english version " is available in hangar".

 

I am completely lost... Stringtable is something I'm using for a long time, usually in mods, with a lot more entries and packages and structured text and stuff. I don't understand why this very simple use is behaving so weird...

Share this post


Link to post
Share on other sites

@Cheitan, check encoding of Stringtable.xml file -- it should be UTF-8 without BOM!

Share this post


Link to post
Share on other sites

Yeah I had some problems with that a while ago, so now I always check encoding first, but in this very case IT IS ALREADY UTF-8 without BOM.

Share this post


Link to post
Share on other sites

Bloody hell, I get it.

There is a missing / for the closing tag for 3 of the entries. Probably due to a missed copy-paste. This might have confused the XML parser of the game, leading to a fully unexpected behaviour but without any kind of warning/error message.

 

I spotted it by re-typing the whole file from scratch and having everything working at first try. I then performed a strict comparison between both files with a dedicated tool and the magic happened.

 

How dumb I may be, from time to time...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×