feat: rilascio 1.2.0, il widget parla italiano, inglese, tedesco e francese e di default segue la lingua del sito, anche con WPML o Polylang
All checks were successful
Release su wordpress.org / rilascio (push) Successful in 45s

This commit is contained in:
Lorenzo Iovino 2026-09-29 16:53:51 +02:00
parent 368682bd07
commit e9c483f885
8 changed files with 59 additions and 8 deletions

View file

@ -29,6 +29,7 @@ function pinfesta_defaults() {
'al' => '',
'cerca' => '',
'font' => '',
'lingua' => '',
);
}
@ -135,6 +136,25 @@ function pinfesta_build_url( $args ) {
$query['cerca'] = mb_substr( $cerca, 0, 40 );
}
// Language of the widget: event texts (when translated), labels and links.
// Empty means "follow the site": the current locale, which multilingual
// plugins such as WPML or Polylang switch page by page. The service speaks
// Italian, English, German and French; any other language gets English,
// which a foreign visitor reads better than Italian.
$lingua = sanitize_key( (string) $args['lingua'] );
if ( '' === $lingua ) {
$lingua = substr( function_exists( 'determine_locale' ) ? determine_locale() : get_locale(), 0, 2 );
}
if ( ! in_array( $lingua, array( 'it', 'en', 'de', 'fr' ), true ) ) {
$lingua = 'en';
}
if ( 'it' !== $lingua ) {
$query['lingua'] = $lingua;
}
// The widget lives in an iframe and cannot inherit the site's font: the
// service offers a few safe stacks to pick from.
if ( in_array( $args['font'], array( 'helvetica', 'serif' ), true ) ) {

View file

@ -9,6 +9,7 @@
* [piazza-in-festa comuni="alba,barolo,la-morra" limite="5"]
* [piazza-in-festa regione="Piemonte" categoria="sagra_enogastronomica,mercatini"]
* [piazza-in-festa regione="Veneto" categoria="mercatini" cerca="natale" dal="2026-11-01" al="2027-01-06"]
* [piazza-in-festa comuni="alba" lingua="en"] (default: the language of the site)
*
* @package PiazzaInFesta
*/