mrlacey / MauiAppAccelerator

A Visual Studio extension to accelerate the creation of new .NET MAUI apps.
https://marketplace.visualstudio.com/items?itemName=MattLaceyLtd.MauiAppAccelerator
MIT License
307 stars 10 forks source link

Add: Settings Page #1

Open mrlacey opened 1 year ago

mrlacey commented 1 year ago

Add an option for a settings page. This should include:

MXM-7 commented 5 months ago

Thank @mrlacey for this great tool ! what if in plus of dark and light setting we allow also to select a language in a combobox listing resources files . Once a new project is created the tool allow user to select as many resources files as needed and one default localization?

mrlacey commented 5 months ago

Thank @mrlacey for this great tool ! what if in plus of dark and light setting we allow also to select a language in a combobox listing resources files . Once a new project is created the tool allow user to select as many resources files as needed and one default localization?

It feels like there are several things all connected here:

  1. Include the ability to add additional resources files (& per platform config) as part of the wizard
  2. [optionally?] include something on the settings page to enable selecting language.

The first point could be entirely separate from a settings page and would provide additional value by adding the iOS, macOS, and Windows-specific config too.

The second point is much more complicated:

MXM-7 commented 5 months ago

Thanks for your quick feedback it's indeed more challenging than I thought but Here are some food for thought

Also its users resposability to do the Localization process by doing whats needed in the XAML and resources files to ensure all there containt are handled. At project creation we may just do it on the few string already availble at project creation.

Same as previously we are just adding a default mecanism and adding resources files again with default string.

Thank you again for your work, please don't take wishs of happy users of your tools as command . I was really thrilled by this project from the begining and even it's too complicated to added will still be very happy and greatful to start my project with this fantastic tool.

mrlacey commented 5 months ago

To avoid this getting too far off the topic of a Settings Page, I've created a separate issue for adding the ability to include a different resource files in the generated app

For other points related to what the addition to the settings page would mean and to clarify some of the above:

The language change would be idealy changed at run time and use default Microsoft Localization library to avoid be dependent to any pluggin that may not be maintened in future.

What do you mean by the "default Microsoft Localization library"? In the example Localization page created via the wizard, it currently shows 3 different ways of localizing the text that is shown in the UI (As a resource, via a markup extension, and via binding) which of these should be used in the generated app? For a feature that only one person has asked for (so far) I'm loath to triple the work involved in creating three different versions and having the user select which one they want.

So that I'm clear from your comments above, you're not advocating for also changing all the pages that can currently be generated in a new app and making all their content (text) localized. I hope that's the case. (It's a lot less work to not have to change everything that already exists.) It would mean populating the resource files with lots of content that I'd expect most people to have (want?) to delete from the generated app.

Before attempting to implement a solution to change the language at runtime, note also the warning at https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/localization?view=net-maui-8.0#test-localization

... your app loads the appropriate localized resources on a per-thread basis, based on the culture specified by the CurrentUICulture property. Warning While it's possible to set the value of CurrentUICulture in code, the resulting behavior is inconsistent across platforms so this isn't recommended ...

While other solutions to localizing content do exist, I'm not clear which is the best or most appropriate to include as a default/recommended solution.