How to make template language independent

    From The Document Foundation Wiki
    This page is a translated version of the page Documentation/HowTo/Impress/Make template language independent and the translation is 4% complete.
    Outdated translations are marked like this.

    Warning: Display title "How to make template language independent" overrides earlier display title "Come rendere indipendente la lingua del modello".

    Other languages:

    Come rendere indipendente la lingua del modello

    Descrizione del problema

    Quando create un modello (per esempio per Impress), molte informazioni vengono memorizzate nel vostro file. Se volete condividerlo in un ambiente internazionale (proponetelo al template site per esempio), dovete rimuovere tutte le informazioni sulla vistra localizzazione (lingua, unità monetaria, formato data ...). Altrimenti, l'utente deve modificare la lingua di molti stili in ogni pagina principale. Se il modello è stato creato da un utente di lingua tedesca, il controllo dell'ortografia verrà eseguito in tedesco.

    Questo how-to spiega come rimuovere tutte queste informazioni (più alcuni extra), in modo che un nuovo utente che apre questo modello avrà il controllo dell'ortografia nella propria lingua, qualunque sia la lingua del creatore del modello.

    When you create a template (for Impress for example), many informations are stored in your file. If you want to share it in an international environment (propose it to template site for instance), you need to remove all information about your localization (language, money unit, date format...). Otherwise, user need to modify language of many styles in each master page. If template was created by a German speaking user, orthography checking will be done in German.

    Preparate il vostro modello

    Modificate il vostro modello in Impress:

    • Rimuovete tutto il testo scritto, ad esempio "Scrivi qui il tuo testo"
    • Lasciate solo caselle di layout vuote
    • Rimuovete data, testo a piè di pagina
    • Rimuovete gli stili inutilizzati; gli stili definiti dall'utente non verranno tradotti. Evitate di usarli e preferite stili predefiniti
    • Rimuovete anche il testo nelle note
    • Salvatelo come modello

    Scegliete la vostra immagine di anteprima

    Nel gestore modelli è visibile un'anteprima del modello. Potreste volere un'anteprima pulita, senza riferimento a nessuna lingua:

    • Aprite il modello per creare una nuova presentazione
    • Scegliete la diapositiva che volete vedere nell'anteprima
    se avete più di una diapositive nel vostro modello, spostate in prima posizione la diapositiva che desiderate vedere in anteprima
    • Inserite il testo "Lorem Ipsum" nel titolo e nel testo per avere una panoramica del carattere utilizzato nel vostro modello. Il testo "Lorem Ipsum" può essere generato in Writer, grazie a un autotext: premete i tasti lorem + F3
    • Salvate la vostra presentazione come file ODP standard. Chiamatelo example.odp.

    Edit your template in Impress:

    • Remove all written text, such as "Write your text here"
    • Let only empty layout boxes
    • Remove date, footer text
    • Remove unused styles; user defined styles won't be translated. Refrain from using them and prefer predefined styles
    • Remove text in Notes also
    • Save it as template

    Modificate il codice XML

    codice XML

    I modelli hanno estensione file come .OT?, con ? che sta per:

    • T = modello .OTT per Writer
    • S = modello .OTS per Calc
    • P = modello .OTP per Impress
    • G = modello .OTG per Draw

    Si veda la domanda Qual è il formato di file utilizzato da LibreOffice? per avere maggiori dettagli, ma in poche parole questi formati di file sono semplicemente archivi compressi contenenti una struttura con file XML (si veda LibreOffice e XML). Quindi per accedere al codice XML, dovete prima decomprimere OT? file. Usate il vostro software di archiviazione preferito per decomprimere. Potrebbe essere necessario rinominare l'estensione del file in .ZIP o meno a seconda del software.

    Contenuto e modifica di un file modello

    Per un modello Impress otterrete una struttura come questa:

    • La cartella Configurations2 dovrebbe essere rimossa. Può essere vuoto o contenere modifiche alla configurazione nelle barre dei menu o nei tasti di scelta rapida. L'utente potrebbe preferire mantenere la propria configurazione quando utilizza il modello
    • La cartella META-INF contiene un solo file manifest.xml. Questo file contiene l'elenco dei file nel modello. Modificatelo e rimuovete qualsiasi riferimento a Configurations2 se l'avete rimosso.
    • La cartella Immagini contiene tutte le immagini utilizzate nel modello. Controllate se avete davvero bisogno di tutte queste immagini. Se ne rimuovete alcune, aggiornate manifest.xml.
    • La cartella Thumbnails contiene l'immagine di anteprima. Lo aggiorneremo in seguito.
    • Non è necessario modificare il file content.xml se si pulisce correttamente il modello in Impress. Potete controllare se non c'è testo.
    • Il file meta.xml contiene informazioni generali sul file: data di creazione, autori, versione utilizzata per compilarlo... Nulla da cambiare qui.
    • mimetype è un file di testo che descrive il tipo di file. Dovrebbe contenere:
    application/vnd.oasis.opendocument.presentation-template
    
    è utile per il sistema operativo che rileva il tipo di file

    La parte principale della pulizia deve essere eseguita nei due file seguenti. Se il vostro file ha una lunga storia, potreste trovare molte cose inutili.

    • Il file settings.xml contiene le impostazioni di molte opzioni che avete usato quando avete creato il modello. Tuttavia, molte di queste impostazioni sono inutili per l'utente, oppure l'utente può preferire opzioni diverse (impostazioni della stampante, opzioni di griglia e snap...). Selezionate tutte le opzioni se volete imporne alcune. Altrimenti potete rimuovere in sicurezza il file (aggiorna manifest.xml) per consentire all'utente di utilizzare le proprie impostazioni.
    • Il file styles.xml contiene tutti gli stili utilizzati nel modello.
      • Cercate e rimuovete i tag di lingua e paese:
        • fo:language="xx"
        • fo:country="XX"
        • style:language-asian="xx"
        • style:country-asian="XX"
        • style:language-complex="xx"
        • style:country-complex="XX"
      • Dimensione, peso e stile del carattere completi per i tag asiatici e complessi (questi tag devono essere duplicati; vedi tdf#114746):
        • Aggiungete style:font-size-asian="xxpt" style:font-size-complex="xxpt" per ogni fo:font-size="xxpt"
        • Aggiungete style:font-weight-asian="wwwww" style:font-weight-complex="wwwww" per ogni fo:font-weight="wwwww"
        • Aggiungete style:font-style-asian="sssss" style:font-style-complex="sssss" per ogni fo:font-style="sssss"

    In the template manager, a preview of the template is visible. You may want a clean preview, without reference to any language:

    • Open the template to create a new presentation
    • Choose the slide you want to see in the preview
    if you have several slides in your template, move to first position the slide you want to see in preview
    • Insert "Lorem Ipsum" text in title and text to have an overview of the font used in your template. "Lorem Ipsum" text may be generated in Writer, thanks to an autotext: hit lorem + F3
    • Save your presentation as standard ODP file. Let's name it example.odp.

    Cambiate l'immagine di anteprima

    • Decomprimete esempio.odp
    • Copiate il file thumbnail.png nella cartella Thumbnails
    • Incollatelo nella cartella del modello per sostituirlo

    Create il file modello

    La semplice compressione di tutte le cartelle e dei file del modello in un file zip creerà un modello che LibreOffice sarà in grado di aprire. Tuttavia, questo file non sarebbe valido poiché il file mimetype verrà compresso e inserito casualmente nel file. Per ottenere un file OpenDocument valido, è necessario posizionarlo all'inizio del file senza compressione.

    Sotto Windows

    Per ottenere tale file, potete leggere How to di Regina Henschel.

    Templates have file extension as .OT?, with ? standing for:

    • T = .OTT template for Writer
    • S = .OTS template for Calc
    • P = .OTP template for Impress
    • G = .OTG template for Draw

    See What is the file format used by LibreOffice? question to have more details, but in a nutshell, these files formats are simply zipped archive containing a structure with XML files (See LibreOffice and XML). So to access XML code, you need first to unzip OT? file. Use your favorite archive software to unzip. You may need to rename file extension to .ZIP or not depending of your software.

    Sotto Linux

    La decompressione viene eseguita semplicemente dal file manager: fate clic con il tasto destro sul file e dal menu contestuale selezionate  ▸ Estrai qui.

    For an Impress template you will get a structure like this:

    • Configurations2 directory should be removed. It may be empty or contain modifications of the configuration in menu bars or short keys. User may prefer to keep his own configuration when using your template
    • META-INF directory contains only one file manifest.xml. This file contains the list of files in the template. Edit it and remove any reference to Configurations2 if you removed it.
    • Pictures directory contains all images used in the template. Check if you really need all these images. If you remove some, update manifest.xml.
    • Thumbnails directory contains preview image. We will update it later.
    • content.xml file should not need to be modified if you correctly clean your template in Impress. You may check if there is no text.
    • meta.xml file contains general information of file: date of creation, authors, version used to build it... Nothing to change here.
    • mimetype is a text file describing the type of the file. It should contains:
    application/vnd.oasis.opendocument.presentation-template
    
    It is useful for OS detecting type of the file

    The main part of cleaning is to be done in the two following files. If your file has a long history, you may find many useless things.

    • settings.xml file contains the settings of many option you used when you created the template. However, many of these settings are useless for the user, or the user may prefer different options (printer settings, grid and snap options...). Check all options if you want to impose some. Otherwise you may safely remove the file (update manifest.xml) to let user uses its own settings.
    • styles.xml file contains all styles used in the template.
      • Search and remove language and country tags:
        • fo:language="xx"
        • fo:country="XX"
        • style:language-asian="xx"
        • style:country-asian="XX"
        • style:language-complex="xx"
        • style:country-complex="XX"
      • Complete font size, weight and style for Asian and complex tags (these tags need to be duplicate; see tdf#114746):
        • Add style:font-size-asian="xxpt" style:font-size-complex="xxpt" for each fo:font-size="xxpt"
        • Add style:font-weight-asian="wwwww" style:font-weight-complex="wwwww" for each fo:font-weight="wwwww"
        • Add style:font-style-asian="sssss" style:font-style-complex="sssss" for each fo:font-style="sssss"

    Per ricomprimere, potete utilizzare i seguenti comandi da console nella cartella contenente il file mimetype:

    zip -0 -X ../template2.otp tipomime
    zip -r ../template2.otp * -x tipomime
    

    La prima riga crea un nuovo file zip, con solo il file mimetype, senza compressione. La seconda riga aggiunge tutti gli altri file in modo ricorsivo, eccetto il file mimetype, con compressione standard

    • Unzip example.odp
    • Copy thumbnail.png file in Thumbnails directory
    • Paste it in the directory of the template to replace it

    Provate il vostro modello

    Il vostro modello è ora pronto per essere testato prima della diffusione. Assicuratevi che sia valido come ODF 1.3.extended, per quanto possibile. Il validatore è su https://odfvalidator.documentfoundation.org/.

    Simply zipping all directories and files of the template in a zip file will create a template that LibreOffice will be able to open. However this file would not be valid as mimetype file will be zipped and randomly placed in the file. To get a valid OpenDocument file, you need to place it at the beginning of the file without compression.

    Contributo al codice di LibreOffice

    La procedura per contribuire con il vostro modello è descritta nel file README qui.

    To obtain such file, you may read How to of Regina Henschel.

    Under Linux

    Unzip is simply done from file manager: right clic on file  ▸ Extract here.

    To re-zip, you can use following commands in console in the directory containing mimetype file:

    zip -0 -X ../template2.otp mimetype
    zip -r ../template2.otp * -x mimetype
    

    First line creates a new zip file, with only mimetype file, without compression. Second line adds all other files recursively, except mimetype file, with standard compression

    Test your template

    Your template is now ready to be tested before diffusion. Make sure it is valid against ODF 1.3.extended, as far as possible. Validator is https://odfvalidator.documentfoundation.org/.

    Contribution to LibreOffice code

    Procedure to contribute your template is described in README file here.