Git Product home page Git Product logo

xc-base-import's Introduction

xc-base-import

xc-base-import is a Node.js tool that allows to import development language XLIFF files straight into the IB documents (storyboards and xibs).

Changelog

v0.0.2

  • The tool uses a different XML handling engine.
  • Now IB documents are not affected more than necessary.

Discussion

In iOS7 Apple introduced so-called "Base localization" which allowed to keep the translation separate from the layout. With this approach you create storyboards and put the user-visible strings in the development language (usually English) straight into them. And when the time for the translation comes, you simply export an hand over to the translators a single XLIFF file, which, when imported, produces .strings files for the new language. This is extremely cool and I suggest every iOS developer to use it. (More info)

But it soon turned out that this straightforward approach can only be used for the languages, different from the development one. If you want to change something in English, you still need to open the storyboard with Xcode and manually introduce the changes. Not that cool, huh?

If you decide to import a en-to-en XLIFF file, it produces a separate "en" localization, breaking the whole idea of Base localization and also leading to a certain number of problems, which is out of scope of this document.

xc-base-import module allows to apply the XLIFF files straight to the IB documents, solving this problem. It also integrates nicely with the PhraseApp, which your localizers are very likely using. You just export an en localization file, put it into this tool and that's it!

What the tool does is it looks into the XLIFF file, finds all the entries, that correspond to storyboards and xibs and puts the values straight into these files.

Installation

$ npm install -g xc-base-import

Usage

This tool has a simple command-line interface. You use it like this:

xc-base-import -x /Users/superman/en.xliff  -p /Users/superman/MyProject

Call xc-base-import --help to find all the available parameters.

Disclaimer

This is a BETA tool, so use it at your own risk. Support with the development is highly appreciated until we get the official support for this from Apple =]

I'm an iOS developer and sort of new to Node.js, so the code may not follow any of the existing guidelines or best practices, feel free to send pull requests, I will most likely accept it.

TODO

  • Parse the project file to find the development language (currently hard-coded to en);
  • Apply the [dev_lang].xliff not only to the IB files, but to other resources, like InfoPlist.strings or Localizable.strings, so that no additional manual steps are required (currently you will need to import the XLIFF using Xcode first, commit changes to the non-IB files, like Localizable.strings, revert the rest and then apply this tool).

Known issues

  • Currently only XLIFF files with the source-language and target-language of en work.

Credits

Daniil Konoplev @ Ombori Group AB 2017

xc-base-import's People

Contributors

danchoys 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.