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]
link |
Stars: 15 |
Last commit: 42 weeks ago |
Updated the library to make usfull internal methods public.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics