#That s the part I m lost with

1 messages · Page 1 of 1 (latest)

keen cloud
#

I would use a ChooseFormatter for this. You can then add a translation for each language as a single field instead of having to put it all together at the end.

proud edge
#

But, thanks fort those links! I'm gonna read 'em out!

keen cloud
#

You would create a single entry in the string table. Mark it smart with the toggle. Then do something like "The day is {myDateVariable:choose(1|2|3|4|5):Mon|Tue|Wed|Thur|Fri}"

#

That would be your English entry

#

Then for the others you just copy it and and replace the English translations

#

Then add a LocalizedString to your script as a public variable

#

In the inspector, Set it to point to the table entry and add a local variable of type integer to it, name it myDateVariable

#

Now you can change its value and the date will update. You can press the Preview button in the inspector for the localized string to test it

proud edge
#

Ok! Let me try it out.

keen cloud
proud edge
keen cloud
#

The localized string? Yeah

proud edge
keen cloud
#

How did you add it?

#

You can't do new to it. The inspector should set it up though

proud edge
keen cloud
#

Don't do the null part

proud edge
#

If I don't, it gives me this error: "Field 'DateTime.localizedString' must be fully assigned before control is returned to the caller", That's why I set it to null

proud edge
keen cloud
#

Initialize it in the struct constructor

proud edge
keen cloud
#

Oh yes I had a typo in my example. It should be separated with| not ,

#

I edited the message to fix it

proud edge
#

Sorry for bothering again, but, is this the correct way to update the variable? if (Days == 0) TimeManager.localizedString.myDateVariable = 0;

proud edge
keen cloud
#

Something like
var date = localizedString["myDateVariable"] as IntegerVariable;
date.Value = 1;

#

If days is an enum then you should be able to cast it as an int.
E.g
date.Value = (int)Days;

proud edge
keen cloud
#

I just wrote a rough short version. I'm on my phone, it's hard to write code 😉