Customer does not want a contact page, but a page where they can write the direction on how to reach the campground, with a Google map embed instead of using Leaflet, because Google Maps shows the reviews right in the map. That means i had to replace the GPS locations with XML fields for the customer to write. In all four languages. This time i tried a translation approach inspired by PrestaShop: instead of opening a new page for each language, i have all languages in the same page and use AlpineJS to show just a single language. It is far easier to write the translations, even though you do not have the source text visible, specially in this section that there is no place for me to put the language links.
26 lines
824 B
PL/PgSQL
26 lines
824 B
PL/PgSQL
-- Deploy camper:translate_location to pg
|
|
-- requires: roles
|
|
-- requires: schema_camper
|
|
-- requires: location_i18n
|
|
|
|
begin;
|
|
|
|
set search_path to camper, public;
|
|
|
|
create or replace function translate_location(company_id integer, lang_tag text, directions text, opening_dates text) returns void as
|
|
$$
|
|
insert into location_i18n (company_id, lang_tag, directions, opening_dates)
|
|
values (company_id, lang_tag, xmlparse(content coalesce(directions, '')), xmlparse(content coalesce(opening_dates, '')))
|
|
on conflict (company_id, lang_tag) do update
|
|
set directions = excluded.directions
|
|
, opening_dates = excluded.opening_dates
|
|
;
|
|
$$
|
|
language sql
|
|
;
|
|
|
|
revoke execute on function translate_location(integer, text, text, text) from public;
|
|
grant execute on function translate_location(integer, text, text, text) to admin;
|
|
|
|
commit;
|