Swiftpack.co - csknns/csv2strings as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by csknns.
csknns/csv2strings 1.1.2
convert Apple's .strings files to and from CSV files
⭐️ 0
🕓 1 week ago
iOS macOS
.package(url: "https://github.com/csknns/csv2strings.git", from: "1.1.2")

master workflow

csv2strings

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.

Usage

Convert from strings to csv

Simply download the package and run:

swift run csv2strings Localizable.strings

It will create an Localizable.csv with 3 columns: key, translation, comments

Convert from csv to strings

swift run csv2strings Localizable.csv

The CSV file must have 3 columns(key, translation, comments)

Parsing a .strings file

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?
    }
}

Author

Christos Koninis, [email protected]

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

v1.0.0
1 week ago

Initial Release.

CLI tool to covert Apple's strings files to/from CSV files. The backing library is also available.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics