Bug 139891 - Create a (XSLT) script to clean up the locale info from the templates.
Summary: Create a (XSLT) script to clean up the locale info from the templates.
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: QA:needsComment
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-25 01:27 UTC by Ezinne
Modified: 2021-02-09 05:10 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ezinne 2021-01-25 01:27:44 UTC
Create an XSLT filter to remove the language-specific pieces of LibreOffice templates, so any random template can be made language-/locale-independent.

The XSLT filter will remove the language-specific details from a .ott file and then repack it as a new .ott.

Each of the template files needs to be unpacked so that the fo:language="en" fo:country="US" and other language-related details can be removed from the files.

Follow the below steps to unpack the template files, 
1. Add .zip to the file name.
2. Extract the zip into a folder.
3. Open the folder and remove the string `fo:language="en" fo:country="US"` from the style.xml file


And finally can also be repacked using: 


>from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
> 
> with ZipFile('path/to/document.ott', 'w') as myzip:
>   myzip.write('path/to/mimetype', 'mimetype', ZIP_STORED)
>   myzip.write('path/to/META-INF/manifest.xml', 'META-INF/manifest.xml', ZIP_DEFLATED)
>   myzip.write('path/to/content.xml', 'content.xml', ZIP_DEFLATED)

And the result passes https://odfvalidator.org.