sqlpage / SQLPage

Fast SQL-only data application builder. Automatically build a UI on top of SQL queries.
https://sql.datapage.app
MIT License
1.57k stars 89 forks source link

Feature request: Internationalization #619

Open maekoos opened 2 weeks ago

maekoos commented 2 weeks ago

It would be really nice to have sqlpage handle internationalization for us. Maybe using a cookie for switching between languages and fallback to Accept-Language, and a json file in sqlpage directory for adding translations for each locale.

Right now the only option would be to use a (temporary?) table or write a function for handling this, which would require manually reading from the headers and cookies for every single text on the web page.

I'm thinking something like this:

SELECT 'text' AS component, sqlpage.i18n('home_title') as title;
{
  "en": { "home_title": "Welcome!" },
  "sv": { "home_title": "Välkommen!" }
}

Wouldn't be too hard to implement and should be sufficient for pretty much all applications.