How do I localize a formatted string

Hello!
So I want to localize my game from English to French, but I have a problem.
My base string is

string.format("%s's water plant", Owner.Value)

which, for my username, shows:

GenericsAccount's water plant

But, in french, I have to put my username at the end, like that:

"Usine d'eau de %s"

So I tried to make it translate from the first string to the second, but it just shows the english version instead of the french one…
So can somebody help me please?

2 Likes

Did you look into this at all yet?

Yes, I did, but it’s really confusing, like I didn’t understand if I should put it in the base string or not (I tried too but it just showed {Owner.Value}'s xxxxx

Why don’t you use this way of format your strings :

local YourString = Owner.Value.."'s water plant"

And I don’t really understand what you want to achieve ?
Sorry for reviving this topic !
Have a nice day !

1 Like

No big deal, still haven’t solved this.

I don’t do it that way because in English it’s:
“%s’s water plant”
but in French it’s
“l’usine à eau de %s”

Thank you!

1 Like

You can escape string by using \
Works fine to me and it will look like that in your scripts:

local MyString = "This massage contains two \' \'"
print(MyString) -- prints This massage contains two ' '
1 Like

Sorry, could you please specify a bit more?
I thought it would be used for something like:

print("Hello, I'm \"print()\".\nI can help you with debugging your script!")

Which would print:

Hello, I'm "print()".
I can help your with debugging your script!

Thank you!

In lua \ basically means ignore the next symbol if it changes the string. Basically, you use it when you don’t want a new string.

String = "Hello"print()"world" -- outputs error

String = "Hello\"print()\"world" --[[ this string will look like Hello"print()"world 
if you print it]]

You can spot the different even in devforum

1 Like

Thank you, but how could I use that to help with localization?

I mostly saw your issue with the strings themselves, which use restricted symbols like '.

1 Like