convert Apple's strings files to and from CSV files
A simple command line utility & library to parse & convert an Appleās strings file to and from a csv file, with first column the translation key and second column the translation value.
Simply download the package and run:
swift run csv2strings Localizable.strings
It will create an Localizable.csv
with 3 columns:
key, translation, comments
swift run csv2strings Localizable.csv
The CSV file must have 3 columns(key, translation, comments
)
import libcsv2strings
let contents: StringsFile = StringsFileParser(stringsFilePath: "path/to/Localizable.strings")?.parse()
Parsing the file to a StringsFile model
/// Top level model of a Apple's strings file
public struct StringsFile {
let entries: [Translation]
/// Model of a strings file translation item
public struct Translation {
let translationKey: String
let translation: String
let comment: String?
}
}
Christos Koninis, [email protected]