fix: le traduzioni non finiscono piu' nel pacchetto, se le genera wordpress.org da translate.wordpress.org

This commit is contained in:
Lorenzo Iovino 2026-09-07 10:55:00 +02:00
parent fbae03e4f3
commit 9811e3b0c4
6 changed files with 14 additions and 184 deletions

View file

@ -22,10 +22,12 @@ mkdir -p "$STAGE"
# Elenco esplicito invece di una lista di esclusioni: se domani si aggiunge un
# file di sviluppo, non finisce nello zip per distrazione.
cp piazza-in-festa.php uninstall.php readme.txt LICENSE "$STAGE/"
cp -R includes blocks assets languages "$STAGE/"
cp -R includes blocks assets "$STAGE/"
# Le traduzioni sorgente (.po) non servono a chi installa, il .mo si'.
rm -f "$STAGE/languages/"*.po
# Niente cartella languages: i plugin ospitati su wordpress.org prendono le
# traduzioni da translate.wordpress.org, e la review rifiuta i .po/.mo/.json
# dentro al pacchetto. Il .po italiano resta nel repo solo come sorgente da
# importare li' una volta approvato il plugin.
( cd "$DIST" && zip -qr "$SLUG.zip" "$SLUG" )
rm -rf "$STAGE"

View file

@ -21,11 +21,14 @@ function pinfesta_register_block() {
);
// The editor strings live in JavaScript, so they need their own JSON
// catalogue. The handle is read back from the registered block instead of
// being guessed: WordPress builds it from block.json and it can change.
// catalogue: wordpress.org builds it from translate.wordpress.org and drops
// it in the languages folder of the site, which is where WordPress looks
// when no path is passed. The handle is read back from the registered block
// instead of being guessed: WordPress builds it from block.json and it can
// change.
if ( $type && ! empty( $type->editor_script_handles ) ) {
foreach ( $type->editor_script_handles as $handle ) {
wp_set_script_translations( $handle, 'piazza-in-festa', PINFESTA_DIR . 'languages' );
wp_set_script_translations( $handle, 'piazza-in-festa' );
}
}
}

View file

@ -1,86 +0,0 @@
{
"translation-revision-date": "2026-09-04 16:00+0000",
"generator": "manuale (nessun build step)",
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"lang": "it_IT",
"plural-forms": "nplurals=2; plural=(n != 1);"
},
"All categories": [
"Tutte le categorie"
],
"No region": [
"Nessuna regione"
],
"Events to show": [
"Quali eventi mostrare"
],
"Towns": [
"Comuni"
],
"Comma separated identifiers, for instance: alba, barolo, la-morra": [
"Identificativi separati da virgola, per esempio: alba, barolo, la-morra"
],
"Or a whole region": [
"Oppure una regione intera"
],
"Category": [
"Categoria"
],
"How many events": [
"Quanti eventi"
],
"From 1 to 20.": [
"Da 1 a 20."
],
"Look": [
"Aspetto"
],
"Theme": [
"Tema"
],
"Light": [
"Chiaro"
],
"Dark": [
"Scuro"
],
"Accent colour": [
"Colore d'accento"
],
"Hex code, for instance #b4315a.": [
"Codice esadecimale, per esempio #b4315a."
],
"Heading": [
"Titolo"
],
"Leave it empty for no heading.": [
"Lascialo vuoto per non avere titolo."
],
"Starting height (px)": [
"Altezza iniziale (px)"
],
"It adapts by itself once loaded.": [
"Si adatta da sola appena carica."
],
"Piazza in Festa: set at least one town or a region in the block settings.": [
"Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
],
"Layout": [
"Aspetto"
],
"List": [
"Elenco"
],
"Cards": [
"Schede"
],
"Carousel": [
"Carosello"
]
}
}
}

View file

@ -1,86 +0,0 @@
{
"translation-revision-date": "2026-09-04 16:00+0000",
"generator": "manuale (nessun build step)",
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"lang": "it_IT",
"plural-forms": "nplurals=2; plural=(n != 1);"
},
"All categories": [
"Tutte le categorie"
],
"No region": [
"Nessuna regione"
],
"Events to show": [
"Quali eventi mostrare"
],
"Towns": [
"Comuni"
],
"Comma separated identifiers, for instance: alba, barolo, la-morra": [
"Identificativi separati da virgola, per esempio: alba, barolo, la-morra"
],
"Or a whole region": [
"Oppure una regione intera"
],
"Category": [
"Categoria"
],
"How many events": [
"Quanti eventi"
],
"From 1 to 20.": [
"Da 1 a 20."
],
"Look": [
"Aspetto"
],
"Theme": [
"Tema"
],
"Light": [
"Chiaro"
],
"Dark": [
"Scuro"
],
"Accent colour": [
"Colore d'accento"
],
"Hex code, for instance #b4315a.": [
"Codice esadecimale, per esempio #b4315a."
],
"Heading": [
"Titolo"
],
"Leave it empty for no heading.": [
"Lascialo vuoto per non avere titolo."
],
"Starting height (px)": [
"Altezza iniziale (px)"
],
"It adapts by itself once loaded.": [
"Si adatta da sola appena carica."
],
"Piazza in Festa: set at least one town or a region in the block settings.": [
"Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
],
"Layout": [
"Aspetto"
],
"List": [
"Elenco"
],
"Cards": [
"Schede"
],
"Carousel": [
"Carosello"
]
}
}
}

Binary file not shown.

View file

@ -11,7 +11,6 @@
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: piazza-in-festa
* Domain Path: /languages
*
* @package PiazzaInFesta
*/
@ -47,11 +46,9 @@ require_once PINFESTA_DIR . 'includes/shortcode.php';
require_once PINFESTA_DIR . 'includes/block.php';
require_once PINFESTA_DIR . 'includes/settings.php';
// Translations are not loaded by hand: WordPress finds them on its own, both
// the ones from translate.wordpress.org and the bundled ones in /languages
// (Domain Path in the header above). Verified on WordPress 7.1 with an it_IT
// site: calling load_plugin_textdomain() changes nothing and Plugin Check
// flags it as discouraged since 4.6.
// Translations are neither loaded by hand nor shipped inside the plugin:
// wordpress.org builds them from translate.wordpress.org and WordPress picks
// them up on its own, since 4.6, without load_plugin_textdomain().
/**
* Registers the front end assets.