mapseed/platform

Localize on client side

zmbc opened this issue · 2 comments

zmbc commented

(Part of #655)

Notes (for myself and others):

How I envision this working:

  • Use jquery.i18n -- convert the current locale files into that "banana" format
  • Register the localization function as a Handlebars helper, and replace the Django localization calls with it
  • Store the locale in localStorage (to emulate what Django's doing, which is, I believe, using a session)
  • On locale change, dynamically grab the new banana file and either send out some "rerender" signal to all templates or (easier) just refresh the page

Potential issue: We take advantage of our two-step templating process by "localizing" strings that themselves contain Handlebars template syntax (for example). There's probably a hacky way to emulate this on the client-side, but it's really not a good way to localize and maybe we should just fix it as part of this change.

zmbc commented

@goldpbear I don't think this is done? Simply using the multiple index.html copies wasn't what I had in mind. I think we can de-prioritize this a bit, though, because we've found a workaround.

@zmbc -- ah right, sorry, I got in an issue-closing mood after merging the static site. Agreed there is more we can do to improve localization as detailed in this issue. Reopening.