Giter Club home page Giter Club logo

mergel10n's Introduction

MergeL10n

Usage

pseudo-to-languages

# first generate the pseudo-language
genstrings -o MyApp/MyApp/L10n/zz.lproj YourSwiftFilesWithLocalizableStrings.swift

# then
MergeL10n pseudo-to-languages \
    --languages="en,de,zh-Hans"
    --base-paths="MyApp/MyApp/L10n"
    --development-language="en"

This will use zz.lproj as source-of-truth and delete any key in the other languages that are no longer in use. It will also add all new keys for the development language file. The comments and keys on zz are the source-of-truth, so the developer controls those. The values, however, are never replaced.

Example:

Initial state

zz:
    /* Developer comment for A */
    "KeyA"="";

    /* Developer comment for B */
    "KeyB"="";

    /* Developer comment for D */
    "KeyD"="";

    /* Developer comment for F */
    "KeyF"="";

en:
    "KeyA"="Some english key for A";

    /* Translator comment for B */
    "KeyB"="Some english key for B";

    "KeyC"="Some english key for C";

    "KeyE"="Some english key for E";

Resulting state

en:
    /* Developer comment for A */
    "KeyA"="Some english key for A";

    /* Developer comment for B */
    "KeyB"="Some english key for B";

    /* Developer comment for D */
    "KeyD"="";

    /* Developer comment for F */
    "KeyF"="";

As you can see:

  • Keys C and E were deleted because they are no longer in use (zz tells the source-of-truth for keys)
  • Keys D and F were added because they were introduced by developer (zz tells the source-of-truth for keys)
  • New keys will have empty value because "en" is the development language. For other languages nothing will be added.
  • Removed keys have their values lost, as they are no longer needed
  • Commends from code will overwrite any comment from translators in your language files.
  • It will ALWAYS sort alphabetically to reduce merge conflicts

Parameters and environment variables

pseudo-to-languages

  • Optional parameter --languages="en,de,zh-Hans", if not found it will look in the environment variables for SUPPORTED_LANGUAGES.
  • Optional parameter --base-paths="MyApp/MyApp/L10n,MyLib/MyLib/L10n", if not found it will look in the environment variables for L10N_BASE_PATHS
  • Optional parameter --development-language="en", if not found it will use English

For Environment Variables you can create a ".env" file in the folder where you run the MergeL10n command (it doesn't have to be the same folder where the executable is in, but the folder you are when you execute it). This file is a key-value list with each key-value pair separated by "=" and one pair per line (\n line break).

mergel10n's People

Contributors

luizmb avatar oguzyuuksel avatar melle avatar lukasliebl avatar

Watchers

 avatar Marcus Ficner avatar James Cloos avatar Luis Reisewitz avatar  avatar

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.