monologue-tool / monologue

Design Interactive dialogues and dynamic storylines for games
https://atomic-junky.itch.io/monologue
MIT License
14 stars 3 forks source link

[REQUEST] Add ability to switch dialogue locale #40

Open RailKill opened 1 month ago

RailKill commented 1 month ago

Describe the feature / enhancement.

There are many ways to go about implementing this feature, the proposal can change through continued discussion, but for now I propose a locale dropdown selection in the Header. This can be added beside the Test button as such:

mono-locale-draw

Below is a sample dropdown UI concept where the user can open the dropdown, click on the "+" button to add a new locale. Each locale selection has an ✏️ edit button to rename it, and a 🗑️ delete button. There could be a ⭐ toggle button to set a locale as an application default, so all new .json files will start with this locale for convenience sake.

mono-locale-drop

Upon selection of a locale, all SentenceNodes, ChoiceNodes and OptionNodes that have actual dialogue lines should automatically switch to the new locale. If the locale was newly created, then those nodes will have empty sentences, ready to accept a new sentence in the new language. Values that are not dialogue lines such as EndPathNode or BridgeNode should NOT be affected.

Extra Notes

Is this a feature for a project you're working on?

Supporting multiple languages is a common and important use case in VNs to reach a wider audience.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Changes to JSON Structure

Following Monologue's design philosophy, I don't think we should introduce .csv files for dialogue localization. Instead, it should be built into the existing JSON. The current idea is proposed to look like this:

Before

"Sentence": "Hello!",
"Voiceline": "hello.mp3"

After

"Sentence": {
    "EN": "Hello!",
    "JP": "こんにちは!"
},
"Voiceline": {
    "EN": "hello.mp3",
    "JP": "hello_jp.mp3"
}

To support this change, the MonologueLine field needs to be able to deal with the locale dictionary to display/save the sentences of each language correctly. MonologueProcess will just need to have one extra step to get the correct locale before displaying the sentence.

Consideration for .csv Translations

I foresee that users may still want to do translations in a .csv file or at least in a table format, where each column represents a locale. Personally, I don't want Monologue to have a .csv file for each .json file; especially when EndPathNode is very strong and we can chain lots of stories. Having each .json spawn an extra .csv is going to be a lot. Creating a UI in Monologue just to support translation tables seems overkill since we don't use .csv. If we want to support any user's existing workflow for .csv, maybe we can have an Import button that will grab the data from a .csv and distribute it into our .json structure, where the ID/key is the node ID, and the locale data will be put into the locale dictionary?

atomic-junky commented 1 month ago

I really like this proposal, the only problem I see at the moment is that it's complicated to have an overview of the translations, to know if any are missing or to compare them easily with other sentences.