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.
38 lines
778 B
Go
38 lines
778 B
Go
/*
|
|
* SPDX-FileCopyrightText: 2023 jordi fita mas <jfita@peritasoft.com>
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package auth
|
|
|
|
import (
|
|
"context"
|
|
"golang.org/x/text/language"
|
|
|
|
"dev.tandem.ws/tandem/camper/pkg/database"
|
|
"dev.tandem.ws/tandem/camper/pkg/locale"
|
|
)
|
|
|
|
type Company struct {
|
|
ID int
|
|
DefaultLanguage language.Tag
|
|
Locales locale.Locales
|
|
}
|
|
|
|
func CompanyByHost(ctx context.Context, conn *database.Conn, host string, allLocales locale.Locales) (*Company, error) {
|
|
company := &Company{
|
|
Locales: allLocales,
|
|
DefaultLanguage: language.Catalan,
|
|
}
|
|
if err := conn.QueryRow(ctx, `
|
|
select company_id
|
|
from company_host
|
|
where host = $1
|
|
`, host).Scan(
|
|
&company.ID,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
return company, nil
|
|
}
|