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
⭐️ 15
🕓 1 year 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: 15
Last commit: 42 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

1.1.2
31 weeks ago

Updated the library to make usfull internal methods public.

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