This PowerShell script extracts the source and translated text from SDLXLIFF files in a specified folder and outputs them to separate .txt
files. Each line in the output file contains a source text and its corresponding translated text, separated by a tab character.
- PowerShell
- Create a batch file named
Run.bat
with the following content:
@echo off
PowerShell.exe -ExecutionPolicy RemoteSigned -File "SDLXLIFF2PlaneText.ps1"
- Save the batch file in the same directory as the PowerShell script (
SDLXLIFF2PlaneText.ps1
). - Double-click the
Run.bat
file or run it from the command prompt to execute the PowerShell script. - When prompted, enter the path to the directory containing the SDLXLIFF files you want to process:
Dir: [FolderPath]
Replace [FolderPath]
with the path to the target directory.
Suppose the batch file is named Run.bat
. Double-click the batch file or run it from the command prompt:
Run.bat
When prompted, enter the path to the directory containing the SDLXLIFF files:
Dir: C:\\Users\\Username\\Documents\\SDLXLIFF_Files
The script will process all SDLXLIFF files in the specified folder and its subdirectories, and output corresponding .txt
files with extracted source and translated text in the same location as the input files.
The script performs the following steps:
- Prompts the user for the folder path containing the SDLXLIFF files.
- Recursively processes all files in the specified folder with a
.sdlxliff
extension. - Loads the XML data from each SDLXLIFF file and extracts the source and translated text.
- Outputs the extracted source and translated text to a new
.txt
file, with each line containing a source text and its corresponding translated text separated by a tab character.
- Windows
MIT
Kenta Goto