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

Load tips title text and other strings from JSON file instead of being hardcoded #79

Open
drojf opened this issue Aug 5, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@drojf
Copy link
Contributor

drojf commented Aug 5, 2022

Currently, the tips menu text is hardcoded:

2022-07-31_00_32_16-Higurashi_When_They_Cry_-_Ch 8_Matsuribayashi

See this line of code: https://github.com/07th-mod/higurashi-assembly/blob/matsuri-mod/Assets.Scripts.UI.Tips/TipsManager.cs#L69

It would be better to load it from the tips.json file (if the field exists, to keep compatibility with older tips.json files)

I need to make some other changes to the DLL - this fix can be bundled with it.

@drojf drojf added the enhancement New feature or request label Aug 5, 2022
@drojf drojf changed the title Load tips text from JSON file instead of being hardcoded Load tips title text and other strings from JSON file instead of being hardcoded Sep 18, 2022
drojf added a commit that referenced this issue Sep 18, 2022
drojf added a commit that referenced this issue Sep 30, 2022
drojf added a commit that referenced this issue Sep 30, 2022
drojf added a commit that referenced this issue Sep 30, 2022
@drojf
Copy link
Contributor Author

drojf commented Sep 30, 2022

I've added a feature where the mod can load strings from a localization.json file.

However, I still need to go through the chapters which have the tips menu text and add a function call to get the text from the localization.json. (Mainly becuase I forgot to do this earlier...)

I've decided to keep this separate from the tips.json file since these strings are not specific to tips/don't get unlocked at certain times etc.

The format is like this:

{
    "allChapters":
    {
        "no-tips-available" : {
            "comment": "This text appears at the top of the tips menu when there are no tips available",
            "text": "No new tips available",
            "textJP": "入手TIPSはありません"
        }
    }
}

Which is deserialized into the following C# class (can add more fields later):

public class LocalizationEntry
{
    public string comment;
    public string text;
    public string textJP;
}

public class LocalizationInfo
{
    public Dictionary<string, LocalizationEntry> allChapters;

    public LocalizationInfo()
    {
        allChapters = new Dictionary<string, LocalizationEntry>();
    }
}

@drojf
Copy link
Contributor Author

drojf commented Oct 25, 2022

Some translation teams have translated the mod menu (F10 menu) text - these texts should be added to the localization.json file.

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

No branches or pull requests

1 participant