I received a suggestion to have a Spanish language version of the app. I think the move would be to host languages at $lang.$baseurl. For example, https://es.everysinglemonth.org. Then some code near the top of index.php would identify the language from $_SERVER['REQUEST_URI].
Because the $lang variable will be used to determine file paths later, we should whitelist languages that we know we have. For now, that could be as simple as:
if($lang != "en" && $lang != "es") $lang = "en";
We'd move the contents of templates into templates/en. Any other copy (like error messages) presented to users should be moved to new template files. Update do_tempate() to pull the correct templates based on the global $lang variable.
Any code that reads or writes to the exports directory should instead point to exports/$lang.
Once this is done and working, then we can duplicate the contents of templates/en -> templates/es and recruit some help translating the language.
Unfortunately this will result in more duplicate work if we are to ever modify templates in the future. For the moment I think this is preferable to building a whole new language engine, given that we're not likely to do many translations at this point.
I received a suggestion to have a Spanish language version of the app. I think the move would be to host languages at
$lang.$baseurl
. For example, https://es.everysinglemonth.org. Then some code near the top ofindex.php
would identify the language from$_SERVER['REQUEST_URI]
.Because the
$lang
variable will be used to determine file paths later, we should whitelist languages that we know we have. For now, that could be as simple as:if($lang != "en" && $lang != "es") $lang = "en";
We'd move the contents of
templates
intotemplates/en
. Any other copy (like error messages) presented to users should be moved to new template files. Updatedo_tempate()
to pull the correct templates based on the global$lang
variable.Any code that reads or writes to the
exports
directory should instead point toexports/$lang
.Once this is done and working, then we can duplicate the contents of
templates/en
->templates/es
and recruit some help translating the language.Unfortunately this will result in more duplicate work if we are to ever modify templates in the future. For the moment I think this is preferable to building a whole new language engine, given that we're not likely to do many translations at this point.