Localized string default value

What does the “Default Value” actually do in a dynamic constant? I’m referring to the Default Value in the Inspector, not creating a value in the Constants Editor and setting the language to default.

It sets the “default value”… not meaning to be flippant
but its the value the constant defaults to if no platform or language specific value is given… which would be the case (usually) for numeric values
it results in the equivalent of

const myConst=97 // where 97 was the supplied "default value"

ie… a constant that does not NEED to be localized.

In a dynamic string constant it is the value that gets used IF you have no other value that would supercede it for THE LANGUAGE THAT THE IDE WILL BUILD in

OK so what does that mean ?

Suppose you have a new project open - it likely defaults to building in the “Default” language (see build settings > shared > build language)
For me that is “english” because thats the language my OS runs in

So if I fill in “default” for a dynamic constant that actually means “this is the value for English”
UNLESS I put a specific entry in the constants value list for English - then this one would be used

The reason to do this ?
If I save then give this project to Christian and he compiles it the “DEFAULT” language would be GERMAN - not english
And the default value is most definitely NOT German.
And if I give that project to Stphane and he builds it the “DEFAULT” language would be French - not english

So “DEFAULT” literally means one of two things

  1. the language that the project is set to build in
  2. if (1) is “default” then its the language the OS is running in

or like I said above

  1. a value that does NOT NEED to be localized ( PI=3.14159… as an example )

Well numbers are a fun instance
They are not as simple as “it uses the default” :stuck_out_tongue:

IF you “localize a numeric constant” by adding versions, which you can do, then AT COMPILE TIME the IDE will select the one for the target & language the IDE will compile in THAT value

It uses rules similar to “default value” for strings

But since the topic was about “localized string default values” I had made no mention of this since it wasn’t germaine

I guess I’m confused as to what the Default Value in the Inspector does differently from the Default entry in the Constants Editor?

If I supply both, the entry in the Constants Editor is used. If I only supply the one in the Inspector, it defaults to that. So, the Inspector’s Default Value is like a default for when a Default isn’t supplied in the Constants Editor… confused, I am.

As I speak English and most of my users speak English, I can simply put the English word in the Default Value in the Inspector and then make no English or Default entry in the Constants Editor. This will mean that everyone will get the English translation UNLESS there is a specific translation for their language in the Constants Editor, right?

Thanks for the answers so far.

right

as I do only deal with English, “DEFAULT VALUE” is the only thing I ever use

[quote=260553:@Gavin Smith]I guess I’m confused as to what the Default Value in the Inspector does differently from the Default entry in the Constants Editor?

If I supply both, the entry in the Constants Editor is used. If I only supply the one in the Inspector, it defaults to that. So, the Inspector’s Default Value is like a default for when a Default isn’t supplied in the Constants Editor… confused, I am.
[/quote]
Right - the ones in the main editor body supersede the “default value” in the inspector - ALWAYS.
So since “default” means “the language we’re building for” if you have a default value & default in the list then the one in the list is used because it matches the language being built for. It supersedes the “default value”.

Unless you share your code with someone who maybe compiles on a different language :stuck_out_tongue:

I tend to always supply the specific values for the language.
That way no matter who compiles it there is an entry for “English” rather than hoping someone who runs an English OS compiles things.
This really only matters if you share code with people who may not be running an English OS.

Thanks Norm and Dave, I’ve got my head around it now.