YarnSpinnerTool / YarnSpinner-Unity

The official Unity integration for Yarn Spinner, the friendly dialogue tool.
MIT License
491 stars 85 forks source link

Yarn Project editor doesn't allow to add some languages #287

Open RedDude opened 1 month ago

RedDude commented 1 month ago

What is the current behavior? I'm unable to select languages "code" (for instance "pt-br", only "pt" is avaliable) from the Yarn Project Localization selector

yarnproject-dropdown

This is a big deal, since some languages "code" can describe really different languages. (like pt-pt and pt-br) Currently, I'm forced to select another language to allow unity to load the string tables. For instance, to have both pt and pt-BR, it is need to have pt-BR as, let say as example, as the Croatian language (hr) code. the game save file and settings ui would have to set yarn as the "hr" language code instead the correct code or have to code to map this value to the correct one (which is not great at all for a non-coder user)

Please provide the steps to reproduce, and if possible a minimal demo of the problem: Just create a Yarn Project in a unity yarn project and click do "add localization" and then click language field and see the options on the dropdown (as the image above)

What is the expected behavior? The editor should allow to select any language, so the dropdown show all language codes (pt-BR, en-PH). or at least the editor should allow me to type the language code.

Maybe a custom editor for Yarn Project is necessary to solve this issue

Still, I not sure this is can be considered a issue with Unity/runtime. since LineProvider dropdown shows more languages. (as shown in the image bellow)

Please tell us about your environment:

Other information Curiously enough, LineProviders do have a dropdown more language options. image-textline-provider

Which support the fact this is may be a bug in the YarnProject editor. The trouble looks to be related to the C# [Language] attribute isn't the same as the Language struct and all standard .NET library.

A non-coder is forced to use a wrong language code as workaround.

A coder can workaround this by editing the "localizations" field inside YarnProject manually to add the language by code. Or maybe create a new lineProvider with handle the localizations (as the UnityLocalizationProvider does)

Still, seems something yarn unity, in specific YarnProject asset editor, should handle properly

Maybe related to this: https://github.com/YarnSpinnerTool/YarnSpinner-Unity/issues/264

Still, I not sure this is only an issue with Unity/runtime. since LineProvider dropdown shows more languages.

KXI System and I did discussed about this in discord: https://discord.com/channels/754171172693868585/754171643990900776/1270125121868402711