GithubHelp home page GithubHelp logo

yshrkt / l10nlint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from s2mr/l10nlint

0.0 0.0 0.0 130 KB

Lint tool for Localizable.strings

License: MIT License

Shell 0.09% Swift 99.22% Makefile 0.70%

l10nlint's Introduction

L10nLint

Lint tool for your Localizable.strings

Lint command

Lint based on your .l10nlint.yml:

l10nlint

When run with Xcode prebuild script, shows warning and errors.

Rules

duplicate_key     Duplicated key should be resolved.
empty_key         Empty localized key should be resolved.
empty_value       Empty localized value should be resolved.
key_order         Between Base and each language file's key should be same order.
mark_syntax       Annotation should have around one space.
mixed_chinese     The mixing of traditional and simplified chinese characters should be resolved.
multi_linefeed    Linefeed should be one.
space_in_key      Key should not have space.
todo              TODOs and FIXMEs should be resolved.

Copy command

This is useful feature!โœจ

Copy keys to each strings based on your .l10nlint.yml:

l10nlint copy [--delete-marker]
usage.mov

Define markers in your Base.lproj/Localizable.strings Surround to copy content with // @copy and // @end keyword. --delete-marker option is delete marker in your Base.lproj/Localizable.strings

If above line on your marker is comment, detect equality line, if above line on your marker is key, detect equality key.

// MARK: Main
"MainKey" = "Main value";
// @copy
"SecondGen1" = "Second gen value 1";
"SecondGen2" = "Second gen value 2";
// @end

Installation

brew install s2mr/tap/l10nlint

Add the following to the dependencies of your Package.swift:

dependencies: [
    .package(url: "https://github.com/s2mr/L10nLint.git", from: "L10nLint version"),
]

Run command:

swift run -c release l10nlint [COMMAND] [OPTIONS]

Install with Mint by following command:

mint install s2mr/l10nlint

Run command:

mint run s2mr/l10nlint [COMMAND] [OPTIONS]

Using a pre-built binary

You can also install l10nlint by downloading l10nlint.zip from the latest GitHub release.

Setup

Place .l10nlint.yml file at your repository root. base_path is directory path that is contains Localizable.strings

Example:

base_path: YourApp/Resources/

disabled_rules:
  - empty_value

todo:
  is_summary_enabled: true
  summary_violation_limit: 20

Command completion

This command is built on swift-argument-parser.

Please refer to this article.

Replace example with l10nlint.

Help

l10nlint --help

---
OVERVIEW: Lint tool for your Localizable.strings

USAGE: l10nlint [--config <config>] <subcommand>

OPTIONS:
  --config <config>       Custom config file path
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  lint (default)          Lint your Localizable.strings
  rules                   Show all rules whether enabled or disabled
  copy                    Copy keys your Base Localizable.strings

  See 'l10nlint help <subcommand>' for detailed help.
l10nlint rules --help

---
OVERVIEW: Show all rules whether enabled or disabled

USAGE: l10nlint rules [--config <config>] [--print-parameters]

OPTIONS:
  --config <config>       Custom config file path
  --print-parameters      Show your rule's parameters in config
  -h, --help              Show help information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.