A simple script that keeps your localization files clean. Supports Swift Package Manager
- Supports
.stringsand.stringsdictfiles - Removes spaces
- Groups keys in
.stringsfiles - Sorts keys alphabetically
- Checks for duplicate, missing and redundant keys
- Checks for missing localization files
Localization.swift [--language <language>] <directory>Arguments:
<directory> The directory relative to your project path that will be used is searching for localization files.
Options:
-l, --language <language> The development language.
Add the package as a dependency to your Package.swift:
dependencies: [
.package(url: "https://github.com/mshurkin/Localization", from: "1.0.1"),
]Then add LocalizationBuildPlugin plugin to your targets:
targets: [
.target(
name: "YOUR_TARGET",
dependencies: [],
plugins: [
.plugin(name: "LocalizationBuildPlugin", package: "Localization")
]
),Add this package to your project dependencies. Select a target and open the Build Phases inspector. Open Run Build Tool Plug-ins and add LocalizationBuildPlugin from the list.
Copy the Sources/Localization/main.swift script to your project. Rename it to Localization.swift. Add Run Script in Build Phases with the following command
${SRCROOT}/Path_To_Localization.swiftLocalization is released under the MIT license. See LICENSE file for more info.