Transr
A Cli mass-updates a XML tag content from csv input. I built it for Salesforce translation xml files update.
It expects two optional parameters:
- a csv-file
- a path to look for xml files
Run transr -h to get details.
Simple logic
Open sample file,
- It uses
api_namecolumn value(e.g.Customer__c) to find a matching file (e.g.Customer__c-en_US.xml) - It uses the
xml_tagcolumn value(e.g.help) to locate a matching tag content(e.g.<help>foo</help>) in the xml file - It updates the tag content
foowith the data from thecontentcolumn of the csv
Preparation
- prepare
file.csvwith matched columns (api_name,xml_tag,content), check sample file. - prepare translation files in
xmlfolder, check sample files
Use sample data to try out
Download this repo which includes sample data: the file.csv and the xml folder.
Run transr in the root path.
It should update the help tag content in the xml file(s) of the xml folder
How to install
If you have Cargo,
run cargo install transr to install it locally.
To-Do
- Add test scenarios
- Robust error handling rather than stopping
- Generalize the usage?