Giter Club home page Giter Club logo

localizablestringstool's Introduction

LocalizableStringsTool

What is it

LocalizableStringsTool is a tool that performs Localizable.strings analysis and helps you to clean up your translations

Motivation

Unfortunately Xcode doesn't check translations on compile time,
and sometimes you see **user_greating_key** instead of Wellcome in your app.
LocalizableStringsTool aims to ensure you that your localization is fine.

If you use SwiftGen or R.swift you probably don’t need this tool

Main Features

LocalizableStringsTool can help you find:

  • Untranslated keys in your code
  • Unused translations
  • Translation duplications
  • Difference in keys set for every language pair

How to use

  • Prepare your custom settings file LocalizableStringsTool.plist otherwise the program will use default settings (see next section for details)
    Please check PlistExample folder for reference
  • Just download LocalizableStringsTool executable file from the latest release and execute it in your terminal
    -OR-
  • Clone the project and compile it by yourself
  • When the work is finished you will get the brief result in the terminal and a detailed one in LocalizableStringsToolResults.txt file

Example of the program execution

Example

How to set up LocalizableStringsTool.plist

Parameter Name Description Default value
projectRootFolderPath Absolute path to your project root folder.
If it is absent the program will ask you for it
unusedTranslations Enable or disable searching for unused translations in your Localizable.strings files
true
translationDuplication Enable or disable searching for translation duplications in your Localizable.strings files
(Several keys with the same value (translation string))
true
untranslatedKeys Enable or disable searching for keys without translation in your source code true
allUntranslatedStrings Enable or disable searching for all strings, treating them as "keys" and adding
"untranslated" of them to a separate list at the end of LocalizableStringsToolResults.txt file.
Could be helpful for some hard cases.
false
differentKeysInTranslations Enable or disable searching for key sets difference for language pairs.
For example en has 100 keys and ru has 110 keys.
Most likely you want to have the same keys amount for any language, and now you can see absent or added keys
true
shouldAnalyzeSwift Enable or disable analyzing Swift files true
shouldAnalyzeObjC Enable or disable analyzing Objective-C files true
customSwiftPatternPrefixes If you use some custom wrappers for NSLocalizedString("myKey", "comment").
For example it can be lang(“myKey”) and you should add here lang(
NSLocalizedString(
customSwiftPatternSuffixes The same but for suffixes.
Add .localized if you use “myKey”.localized instead of NSLocalizedString("myKey", "comment")
customObjCPatternPrefixes The same but for Obj C.
Also add here prefixes that can help the program to find keys in source code.
For example if you use keys as func parameters and made localisation inside it
+ (void)showAlertInViewController:(UIViewController *)controller withTitle:(NSString *)title message:(NSString *)message
and call it
[AlertService showAlertInViewController:self withTitle:@"some_title" message:@"some_message"];
you should add withTitle: and message: here
NSLocalizedString(
swiftPatternPrefixExceptions Add here prefixes that tells that this is not localization key for sure.
For example Animation.named( for Animation.named(“animation_key”)
objCPatternPrefixExceptions The same but for Obj C
keyNamePrefixExceptions If you have some prefix for your keys, that tells that this is not a key for translation, add it.
For example somebody uses ic_ as prefix for all icons
keyNamePattern Some specific rules for all your keys.
Example: [_a-z0-9]*[_][a-z0-9]+ for snake_case
[.]+
excludedUnusedKeys Keys that the program mistakenly marks as unused.
Add them to prevent adding unwanted keys to the result
excludedUntranslatedKeys Keys that the program mistakenly marks as not having a translation.
Add them to prevent adding unwanted keys to the result
excludedFoldersNameComponents If file path has this string as part, it will be ignored.
you probably don't want to check translation of third party libraries
Pods

localizablestringstool's People

Contributors

andriipetrovdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

g01dt00th

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.