Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow settings localization #21

Open
SaulHE opened this issue Apr 19, 2020 · 3 comments
Open

Allow settings localization #21

SaulHE opened this issue Apr 19, 2020 · 3 comments

Comments

@SaulHE
Copy link

SaulHE commented Apr 19, 2020

Hi, Mipen.

I have been using you Modlib for my mod GrowUpAndWork.

And after I reference your lib as a required mod and as an external lib. It's very handy..

However, I encounter a problem.

Let's say I have a demand for localize it for some other language users.

Well the attributes of setting class attribute could not be easily changed in runtime.

(The SettingProperty.displayName and Hint field).

Could you maybe provide a way to change them in the future. I would like to detect the use's game language and change them accordingly.

Thanks!

@brandonm4
Copy link

I have also had this request.

@MLNW
Copy link

MLNW commented Apr 21, 2020

I would recommend changing the issue title to something more descriptive. Maybe something like: Allow settings localization

This is partly a duplicate of #22, which has a more descriptive issue title already.

@SaulHE SaulHE changed the title ASuggestionWithTheSettingClass Allow settings localization Apr 21, 2020
@brandonm4
Copy link

Could you do something as simple as this:
SettingPropertyAttribute.cs

public SettingPropertyAttribute(string displayName, float minValue, float maxValue, float editableMinValue, float editableMaxValue, string hintText = "")
{
DisplayName = new TextObject(displayName).ToString();
MinValue = minValue;
MaxValue = maxValue;
EditableMinValue = editableMinValue;
EditableMaxValue = editableMaxValue;
HintText = new TextObject(hintText).ToString();
}

This would let us pass in descriptions like {=abc123}PropertyName and it should run through the localization process. Although we may have to put our xml files in the ModLib/ModuleData/Languages folder for it to find them (would need to test). If that is the case you would also need to run LocalizedTextManager.LoadLocalizationXmls(); in your SubModule OnLoad event as well if you're not already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants