This tool will convert sheets in an Excel file or a path full of Excel files to .NET resource files. The reason this tool was developed was to give other non-technical people the possibility to translate resources from a mobile app in Xamarin without needing to edit resource files. Everybody knows how to use Excel, right?
The best is to download the binary for your platform and run the executable.
To build from source, you'll need to clone the repository and run go build -o ./bin/Excel2Resource main.go
from within the cmd directory.
To run the command only once to generate the resources, you can use:
./Excel2Resource --output=~/Projects/Mobile.App/Resx/ --input=~/Projects/Mobile.App/Translations.xlsx
To watch a file or directory and generate on each save.
Command
./Excel2Resource --output=~/Projects/Mobile.App/Resx/ --input=~/Projects/Mobile.App/Translations.xlsx --watch=true
- It will remove spaces in the sheet name to use as a file name.
- It will replace spaces in identifiers (first column) with underscores
_
. - It will skip rows that are empty or start with
'-
.
The example template from this repo will result in:
- AppResources.resx
- AppResources.en-UK.resx
- AppResources.nl.resx
- AppResources.de.resx
- AppResources.es.resx
If you want to ignore a row it needs to be empty or start with a dash. You can achieve this in Excel with entering '-
in a cell.
The following command reads the resource file Translations.resx (and the specific language translations .nl.resx, .en-UK.resx, .de.resx, .es.resx) and saves it as Translations.xlsx.
This functionality is not fully tested yet.
./Excel2Resource -input=./Resx/Translations.resx -output=. -invert=true
I don't think it will do any harm but just in case: use this tool at your own risk.