lenglel
18th Feb 2011, 03:19 AM
:help:
I'm working on a new mod and I want to add localization so it can
be translated into other languages.
This is my basic localization code:
private const string sLocalizationKey = "Sims3/Gameplay/Objects/Decorations/Mimics/LWEBaseClass";
//methods
public static string LocalizeString(string name, params object[] parameters)
{
string key = sLocalizationKey + ":" + name;
string localizedString = "";
if (Localization.HasLocalizedString(key))
localizedString = Localization.LocalizeString(key, parameters);
else localizedString = name;
return localizedString;
}
public static string Localize(string name)
{
return Localize(name, new object[0]);
}
public static string Localize(string name, params object[] parameters)
{
return LocalizeString("Sims3/Gameplay/Objects/Decorations/Mimics/LWEBaseClass" + name, parameters);
}
This is an example of how it is used:
SimpleMessageDialog.Show(Localize("LWEInteraction.run()"), Localize("theActor == null"));
How do I get something in my pie menu besides the key+name?
I think it has something to do with the stbl resources in the package,
but what you see here is all I've been able to get from the scripting
tutorials. I haven't found a specific tutorial aimed at localization.
Is there a tutorial on this subject somewhere, or can someone offer
some advice on the subject? I'd rather not do an English-only mod.
I'm working on a new mod and I want to add localization so it can
be translated into other languages.
This is my basic localization code:
private const string sLocalizationKey = "Sims3/Gameplay/Objects/Decorations/Mimics/LWEBaseClass";
//methods
public static string LocalizeString(string name, params object[] parameters)
{
string key = sLocalizationKey + ":" + name;
string localizedString = "";
if (Localization.HasLocalizedString(key))
localizedString = Localization.LocalizeString(key, parameters);
else localizedString = name;
return localizedString;
}
public static string Localize(string name)
{
return Localize(name, new object[0]);
}
public static string Localize(string name, params object[] parameters)
{
return LocalizeString("Sims3/Gameplay/Objects/Decorations/Mimics/LWEBaseClass" + name, parameters);
}
This is an example of how it is used:
SimpleMessageDialog.Show(Localize("LWEInteraction.run()"), Localize("theActor == null"));
How do I get something in my pie menu besides the key+name?
I think it has something to do with the stbl resources in the package,
but what you see here is all I've been able to get from the scripting
tutorials. I haven't found a specific tutorial aimed at localization.
Is there a tutorial on this subject somewhere, or can someone offer
some advice on the subject? I'd rather not do an English-only mod.