+ All Categories
Home > Technology > Tml for Ruby on Rails

Tml for Ruby on Rails

Date post: 15-Apr-2017
Category:
Upload: michael-berkovich
View: 96 times
Download: 0 times
Share this document with a friend
32
translationexchange.com Powered by Translation Exchange Translation Markup Language for Ruby on Rails
Transcript
Page 1: Tml for Ruby on Rails

translationexchange.com

Powered by Translation Exchange

Translation Markup Language for Ruby on Rails

Page 2: Tml for Ruby on Rails

Michael [email protected]

@translationx

translationexchange.com

Page 3: Tml for Ruby on Rails

Localization is cumbersome

translationexchange.com

Page 4: Tml for Ruby on Rails

There are many standards, but little guidance.

Page 5: Tml for Ruby on Rails

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

Page 6: Tml for Ruby on Rails

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

FILE FORMATSLots of translation

Microsoft .rcPHP .iniPHP .confBabel Flash .xmlBlackberry .rrcNSIS .inshQT Linguist .tsLatex .latexDocbook .dbkTBX .tbxTMX .tmx

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

Page 7: Tml for Ruby on Rails

Extract content into files

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

BOTTLENECKFile management is a

Page 8: Tml for Ruby on Rails

File Management● Not DRY (Don’t Repeat Yourself)

● Requires content extraction, sync with a TMS or an LSP

● Mini “waterfalls” in the agile process

● Slows down development cycle and releases

● High upfront cost and maintenance

Page 9: Tml for Ruby on Rails

How can we make itBETTER FOR EVERYONE

Page 10: Tml for Ruby on Rails

What would an ideal solution look like?

● ConsistencyProvide tools that offer a clear and

consistent way for internationalizing

content across all frameworks

● AdaptabilityTools must be extensible and adaptable

and should be able to solve any arising

internationalization and localization

problem

● ContextualizationAllow translators to translate in context

from within the application

● AgilityKeep the development cycle agile -

localization must not add significant

overhead for developers - it must be done

in parallel to the development process

Page 11: Tml for Ruby on Rails

あA

Translation Management Service

Global CDNLocal Cache

Application with SDK

A Better WayA truly automated and continuous localization

Page 12: Tml for Ruby on Rails

Translation Cachingstatic and dynamic cache adapters for storing translations in your application

Inline Translation ToolsTranslation can be done in context of the application

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

Open Sourceall SDKs are available on github

Multiple Platformssupport for Rails, Node, PHP, Python, iOS, Android and more

Universal Translation MemoryTranslations are shared across all applications

translationexchange.com

Core Benefits

Page 13: Tml for Ruby on Rails

Getting Started

translationexchange.com

Page 14: Tml for Ruby on Rails

gem 'tml-rails'

Integration

# Gemfile

translationexchange.com

Page 15: Tml for Ruby on Rails

Configuration

# initializers/tml.rb

Tml.configure do |config|config.application = {

key: “YOUR_APPLICATION_KEY”}

end

translationexchange.com

# layouts/application.html.erb

<%= tml_scripts_tag %>

<%= tml_language_selector_tag(:flags) %>

Page 16: Tml for Ruby on Rails

Translation Markup LanguageDeveloper friendly syntax for marking up application content. Supports language context rules and language cases, making translations significantly more accurate for any language.

translationexchange.com

Page 17: Tml for Ruby on Rails

Hello World

<%= tr('Hello World') %>

translationexchange.com

Translation Markup Language

Page 18: Tml for Ruby on Rails

tr('Eats shoots and leaves', 'a panda')

Eats shoots and leaves

tr('Eats shoots and leaves', 'a violent restaurant patron')

Translation Markup LanguageDescription & Context

Page 19: Tml for Ruby on Rails

Hello Michael

translationexchange.com

Translation Markup LanguageData Tokens & Interpolation

<%= tr('Hello {name}', {name:'Michael'}) %>

Page 20: Tml for Ruby on Rails

Hello Michael

<%= tr('Hello [bold: {user}]', { user: current_user

}) %>

translationexchange.com

Translation Markup LanguageDecoration Tokens

Page 21: Tml for Ruby on Rails

Hello Michael

<%= tr('Hello <strong>{user}</strong>', { user: current_user }) %>

translationexchange.com

Translation Markup LanguageDecoration Tokens

Page 22: Tml for Ruby on Rails

Hello Michael

<%= tr('Hello [bold: {user}]', { user: current_user,

bold: '<strong>{$0}</strong>' }) %>

translationexchange.com

Translation Markup LanguageDecoration Tokens

Page 23: Tml for Ruby on Rails

You have 5 messages

<%= tr(You have {count || message}', { count: 5

}) %>

translationexchange.com

Translation Markup LanguagePluralization

Page 24: Tml for Ruby on Rails

Michael uploaded 3 photos

<%= tr('{user} uploaded {count || photo}', { user: current_user, count: 3 }) %>

translationexchange.com

Translation Markup LanguagePluralization

Page 25: Tml for Ruby on Rails

Michael liked Anna’s post

<%= tr('{actor} liked {target::pos} post', { actor: current_user, target: other_user }) %>

translationexchange.com

Translation Markup LanguageLanguage Cases

Page 26: Tml for Ruby on Rails

This is your second warning

<%= tr(This is your {count::ord} warning', { count: 2}) %>

translationexchange.com

Translation Markup LanguageLanguage Cases

Page 27: Tml for Ruby on Rails

Michael completed 3 miles on his last run.

<%= tr('[link: {user}] completed [bold: {count || mile}] on {user | his, her} last run.', { user: current_user, link: { href: user_path }, count: 3}) %>

translationexchange.com

Translation Markup Language

Page 28: Tml for Ruby on Rails

Demo❏ Use TML SDK to localize an online recipes application❏ Demonstrate crowdsourced localization tools❏ Deploy translation release and update application realtime❏ Download release snapshot and run Foody independently from the

service

translationexchange.com

Page 29: Tml for Ruby on Rails

How is Translation Done?

translationexchange.com

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.

Page 30: Tml for Ruby on Rails

Caching Options

translationexchange.com

Static CacheFile based cache. Loaded into the process memory and must be deployed with the source code. Each process contains the entire translation cache.

$ bundle exec rake tml:cache:generate

Dynamic CacheRedis, Memcached (and others) updated from CDN release. Cache is shared across all processes. Can be deployed without restarting servers.

$ bundle exec rake tml:cache:upgrade

Page 31: Tml for Ruby on Rails

SDKs https://github.com/translationexchangeDocumentation http://translationexchange.com/docsBlog http://blog.translationexchange.comFoody Source https://github.com/translationexchange/tml-rails-samples-foodyFoody Live http://foody.translationexchange.comFacebook https://www.facebook.com/translationexchangeTwitter @translationxFeedback [email protected]

translationexchange.com

Resources

Page 32: Tml for Ruby on Rails

Thank YouFind out more at translationexchange.com

translationexchange.com


Recommended