Tml for Objective C

Post on 15-Apr-2017

65 views 3 download

transcript

Powered by Translation Exchange

Translation Markup Language for Objective C

TranslationExchange.com

Michael Berkovichmichael@translationexchange.com

@translationx

TranslationExchange.com

Localization is hard

There are many standards, but little guidance.

Every i18n framework has its own “right way” of doing things, with a different syntax and file format.

Developers often hack together their own solutions to try and simplify the process.

No universality in the current standards

Android .xmlApple .stringsApple .plistGettext .poGettext .potJava .properties Java .xmlMicrosoft .resxMicrosoft .reswMicrosoft .resjsonMicrosoft .aspx

FILE FORMATSLots of translation

Microsoft .rcPHP .iniPHP .confLaravel .phpBlackberry .rrcNSIS .inshQT Linguist .tsLatex .latexDocbook .dbkTBX .tbxTMX .tmx

XLIFF .xliffYouTube .sbvRails YAML .yamlSubtitles .srtMicroDVD .subSubviewer .subMozilla Web L10NText .txtCSV SpreadsheetExcel SpreadsheetWord Document

Extract content into files (genstrings)

Upload files to a TMS or an LSP

Wait... Download translated files

Put translations back in your app

Repeat when new content is added or changed

BOTTLENECKResource file management is a

How can we make itBETTER FOR EVERYONE?

TranslationExchange.com

An Ideal Solution

● ConsistentProvide tools that offer a clear and

consistent way for internationalizing

content across all frameworks

● AdaptableTools should be extensible and adaptable

and must be able to solve any arising

internationalization and localization

problem

● ContextualAllow translators to translate in context

from within the application

● AgileKeep the development cycle agile -

localization must not add significant

overhead for developers - it must be done

in parallel to the development process

TranslationExchange.com

An integrated and automated continuous localization

あA

Translation Management Service

Global CDNLocal Cache

iOS Application with TMLKit

A Better Way

TranslationExchange.com

Translation CachingNo impact on app performance, translations are loaded from local cache.

Inline Translation ToolsTranslation can be done within app context

Access Professional TranslatorsConnect your application to thousands of professional translators around the world

Open SourceSource code is available on github

Multiple PlatformsSupport for iOS, Rails, Node, PHP, Laravel, Python, Django, J2EE, Android and more

Universal Translation MemoryTranslations are shared across all applications

Core Benefits of TML SDK

TranslationExchange.com

Getting Started

TranslationExchange.com

pod "TMLKit"

Integration

// Podfile

TranslationExchange.com

Configuration

// main.m

#import <UIKit/UIKit.h>#import "AppDelegate.h"

int main(int argc, char * argv[]){ @autoreleasepool { [TML sharedInstanceWithApplicationKey:@"YOUR_APP_KEY"]; return UIApplicationMain(argc, argv, nil,

NSStringFromClass([AppDelegate class]) ); }}

TranslationExchange.com

Integration Options● Fully automatic

Just activate the SDK, and we do the rest

● Based on NSLocalizedString macrosActivate the SDK, include our header and we take over

● Using TML macrosEnhance the translations with TML macros

TranslationExchange.com

Internationalization

// wrap strings with the tr methodNSLocalizedString(@"Hello World", nil)

// use interpolationTMLLocalizedString(@"Hello {user}", @{@"user": @"Alex"})

// and many other features of TML syntax...TMLLocalizedAttributedString(@"Hello [bold: World]")

TranslationExchange.com

Translation Markup Language (TML)● Simple, yet powerful, syntax for marking up application strings.

● Supports language context rules and language cases, making translations accurate for any language.

● Backwards compatible to standard I18n

TranslationExchange.com

DEMO

TML for Objective C Basics

Hello World

Identical syntax is available in Rails, PHP, Java, Python, Javascript, Node.JS, Ember, Angular, etc...

TMLLocalizedString(@”Hello World”)

Descriptions

TMLLocalizedString(@”Eats shoots and leaves”, @”a panda”)

Eats shoots and leaves

TMLLocalizedString(@”Eats shoots and leaves”, @”a violent restaurant patron”)

Interpolation

TMLLocalizedString(@”Hello {name}”, @{@”name”: @”John”})

Hello John

Decoration Tokens

Hello WorldWorld

TMLLocalizedAttributedString('Hello <bold>World</bold>', @{ @”bold”: @{ @"font": [UIFont fontWithName:@"ChalkboardSE-Bold" size:14]

}})

Uses Native Decoration Methods

Decoration TokensTMLLocalizedAttributedString(

@”Hello <indent>World</indent>”, @{@”indent”: @”<strong>{$0}</strong>”]

)

TMLLocalizedAttributedString(@”Hello <strong>World</strong>”

)

Hello WorldWorld

or

TMLLocalizedAttributedString(

'[bold: {user}] completed [bold: {count || mile}] on [bold: {user | his, her} last run].',

@{@'user’: userObject,@'count’: milesCount

})

More Complex Example

Michael completed 3 miles on his last run.

TMLLocalizedString(@”Welcome to {user::pos} blog.”, @{ @”user”: @”Michael”})

Language Cases

Welcome to Michael’s blog.

Ordinals

This is your second warning

TMLLocalizedString('This is your {count::ord} warning', @{ @”count”: @2})

Genstrings

This is your second warning

$ genstrings ./classes -a TOKEN

TranslationExchange.com

TMLDEMO

Distribution Options

Packaged BundleAdd a release bundle to your app and it will be unpacked and configured the first time application is run.

Dynamic BundleRelease translations to the CDN and they will be synced down to your application.

TranslationExchange.com

How is Translation Done?

Machine Translationprovided by Google, Microsoft and Yandex. Translations are ranked to get the best result.

Crowdsourced TranslationSome developers may choose to use their own users to translate their content, similar to how Facebook and Twitter translated their sites.

Professional TranslationOrder are received and processed by our partners and are made available in our system within hours.

TranslationExchange.com

UNIVERSAL TRANSLATIONMEMORY

● Translations should be reusable across multiple projects

● Each translation key can have many

translation options for a language based

on context

● Translation keys and translations are

unique and are only stored once in the

entire system

What is UTM?

Hello World Hola Mundo

안녕하세요Привет Мир

Hallo Welt שלום עולם

你好,世界

UTM Graph

SUMMARY& CONCLUSION

Resources

TMLKit https://github.com/translationexchange/tml-objc

Documentation http://docs.translationexchange.com

Blog http://blog.translationexchange.com

Facebook https://www.facebook.com/translationexchange

Twitter @translationx

Support support@translationexchange.com

Thank youQUESTIONS?