nerves-networking / vintage_net_wizard

WiFi configuration wizard using vintage_net
Apache License 2.0
59 stars 20 forks source link

Support i18n #140

Open fhunleth opened 4 years ago

fhunleth commented 4 years ago

All text is currently hardcoded English strings. This issue is for refactoring the code base to support translations.

lucaong commented 4 years ago

One proposal that could make this simpler, and also help with #117, would be to let users optionally "bring their own UI" by providing a Plug to be used for the UI in router.ex in place of the default one that renders index.html.

For example, the configuration could be:

config :vintage_net_wizard,
  ui: MyCustomWizardUIPlug

and the router.ex could use it as:

ui_plug = Application.get_env(:vintage_net_wizard, :ui, DefaultUIPlug)

# Here I an namespacing the UI under /ui, which I think is a good idea
# if we make the UI customizable
forward "/ui", to: ui_plug

# Other API endpoints could stay as they are, so the UI can use them:
forward "/api/v1", to: VintageNetWizard.Web.Api

This is a relatively small change that would enable users to customize the UI without having to fork the project. It would also make further development on the project more flexible, clarify what part is public API that one can rely upon and what part is private implementation details, and make it possible for people to create alternative wizard UIs (maybe including I18n) and offer them as libraries.

WDYT?