SlideShare a Scribd company logo
1 of 46
Download to read offline
Tr8n for PHP
Crowdsourced Translations
Presented by Michael Berkovich
michael@tr8nhub.com

https://github.com/tr8n/tr8n_php_clientsdk
About Me
● Software Engineer at Digital Evolution, US
Interactive, SOA Software, Geni, Yammer

● Creator of Tr8n translation framework
● Founder and CTO at Tr8nHub.com
What is Tr8n?

Tr8n = Tr[anslatio]n
pronounced “tr - 8 - n”

Translation framework, platform, technology.
Tr8n Timeline
2009

Started as a Ruby library to translate Geni.com to 70 languages.

2010

RoR Gem is created and adopted by Yammer and a number of
companies around the world. Tr8n Gem is open sourced.

2013

Tr8nHub server (beta) is launched as a shared Translation Memory
and Language Rule Repository.

2014

Ruby, PHP, Objective C, JavaScript, C# and Java SDK libraries are
added to support all major platforms.
Tr8n Core Features
● Translation Markup Language (TML)
● Rules Engine with Centralized Repository
● Shared Translation Memory (TM)
Additional Features
●
●
●
●
●
●
●

No resource bundles
Support for over 300 languages
Crowdsourced translation tools
Inline and bulk translation modes
Intuitive user interface and admin tools
Custom translation workflows
Glossaries, forums, etc...
Your Application
PHP, Rails, Java,
iOS, JavaScript, Python,
Perl, .Net, etc...

Tr8n SDK

Tr8n SDK + Tr8nHub

API

Tr8nHub.com
TM, Rules, UI
Widgets, Workflows,
Management, etc...

Cache
Files, APC,
Memcache, Redis,
CHDB, DB,...
Tr8n SDKs

● API Client
● Rules Engine + TML
● Cache Adapters
Tr8nHub Platform

●
●
●
●
●

Translation Management
User Interface and Widgets
Shared Translation Memory
Translator Tools
Workflows, etc...
Translation Overview
Why Crowdsourcing?
● Use your own users to translate your
application
● No “Golden Gate Bridge Syndrome”
● Self-monitoring and auditing system
● Low cost for adding new languages
Tr8n Ranking Systems
Translation rank
- total sum of all positive and negative votes for a
translation
Application threshold
- the minimum translation rank to be displayed in an
application
Translator rank
- a ratio between the total submitted translations and
accepted translations
Translation Rank
● When user adds a translation, it automatically
gets +1 vote/rank
● User can only submit one vote for each
translation
● Other users can vote +1 or -1 per translation
● Total sum of all +1 and -1 is the rank of the
translation
Application Threshold
● Threshold controls which translations will be
used in the application
● Lower number allows for more aggressive
translations
● Higher number requires more users to vote
before the translation is accepted
● Users may have different voting powers based
on their ranks and levels
Translation Monitoring
● Each translation is checked against dirty word
filters
● Bad translations are rejected and translators are
put on the watch list
● Reported translations are not deleted, but voted
-100 points
● Admin tools allow for close monitoring of the
progress and identify violations
Translation States
Accepted
- translation rank is above the application threshold
Pending
- translation rank is between 0 and the application
threshold
Rejected
- translation rank is below 0
Levels & Permissions
● Each translation key and translator has a level
● By default all keys and all translators have level 0
● Translators can only translate keys at their level or
below
● Levels can be assigned to keys and translators, or
to entire sections of the app
Translator Rank
● Calculated every time translations are voted
up or down
● Reporting a translation puts a translator on a
watch list
● Translators can be blocked by admins and
their translations can be automatically
suspended or rejected
Managers
● Translators can be promoted to
managers
● Managers get higher voting power
● Managers can configure application
setting and language rules
Translation Key Locks
● Managers can lock and unlock translation keys
for a specific language
● Locked keys will no longer be available for
translation
● Reporting a translation for a translation key can
unlock the key
SDK Integration
Supported Platforms
●
●
●
●
●
●
●

PHP (>= 5.3)
Ruby on Rails (>= 3.2)
JavaScript
Objective C, iOS (>= 6.2)
Java (work in progress)
Python (work in progress)
.Net, C# (work in progress)
Install Composer

$ cd PROJECT_FOLDER
$ curl -s http://getcomposer.org/installer | php
Configure Composer
Create composer.json file with the following:

{
"require": {
"tr8n/tr8n-client-sdk": "dev-master"
}
}
Install Vendor Packages

$ php composer.phar install
Get Application Key & Secret
Sample PHP File
<?php require_once(__DIR__ . '/vendor/tr8n/tr8n-client-sdk/library/Tr8n.php'); ?>
<?php tr8n_init_client_sdk("https://tr8nhub.com", your_app_key, your_app_secret); ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo tr8n_current_language()->locale ?>"
dir="<?php echo tr8n_current_language()->direction ?>">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<?php include(__DIR__ . '/vendor/tr8n/tr8n-client-sdk/library/Tr8n/Includes/Scripts.php'); ?>
</head>
<body>
<?php tre("Hello World") ?>
</body>
</html>
<?php tr8n_complete_request() ?>
Translation Markup Language
TML™
Translation Markup Language
● Simple and extensible syntax
● Platform and technology independent
● Improves code readability
● Code completion support is coming...
TML Modes
● Simple TML
○ Used by beginner and intermediate translators

● Advanced TML
○ Available through TML extensions
○ Used by developers and advanced translators
TML

<?php echo tr(“Hello World”) ?>
Translation Method
<?php echo tr($label, $description = "", $tokens = array(), $options = array()) ?
>

● $label - required string
● $description - optional context of the label
● $tokens - optional hash of tokens; required if
tokens are used in the label
● $options - optional array of options
Alternatives
<?php echo tr($label, $tokens = array(), $options = array()) ?>
<?php echo tr(array(

“label” => “”,
“description” => “”,
“tokens” => array(),
“options” => array()
)
) ?>
Additional Methods
● tre(...) - automatically echos the result
● trl(...) - disables inline translations; used for options
and alt tags
● trle(...) - same as trl without inline translations

<img src=”picture.png” alt=”<?php trle(‘Profile photo’) ?>”>
Label Description

Are these the same?

<?php tre(“Home”, “Place of residence”) ?>
vs
<?php tre(“Home”, “Main page of the site”) ?>
Label Description
● The description is not mandatory, but it should be used when the
label is ambiguous
● Tr8n uses label and description together to create a unique key for
each translation key
● The description serves a hint to the translators for the context in
which the key was used
TML Tokens
TML Tokens
●
●
●
●
●

Dynamic data substitution
Minimize the number of translation keys
Maximize translation key reuse
Decorate translation key elements
Nest translations (but don’t take them
out of context)
TML Token Types
● Data Tokens
○ Curly brackets with a name of a token
○ {token_name:type::case}
○ Supports extensions (Pipes and Methods tokens)

● Decoration Tokens
○ Square brackets with a name of a decoration
○ [token_name] value_to_be_decorated [/token_name]
○ [token_name: value_to_be_decorated]
TML

DEMO TIME !!!
Other Features
Blocks
○
○

Provide a mechanism to specify options to all nested
translation calls
Can be nested

Sources
○

Allow grouping of translation keys per page, include,
or any structure

Components
○

Groups of sources assigned to translators for specific
languages
Caching
Tr8n Caching
● Tr8n API is only used in translation mode and in a
cache warm-up mode
● In all other cases all data is served from local cache
● SDKs have a mechanism to invalidate and rebuild
cache
Supported Cache Adapters
●
●
●
●
●

Files (JSON or YAML)
APC
Memcached (Memcache)
Redis
CHDB

● Easy to add others
Resources
●
●
●
●
●

Tr8nHub service
○ https://tr8nhub.com
Documentation
○ http://wiki.tr8nhub.com
Blog
○ http://blog.tr8nhub.com
SDK Source Code
○ https://github.com/tr8n/tr8n_php_clientsdk
PHP Sample Service
○ http://php.tr8nhub.com

My Email: michael@tr8nhub.com
Twitter: @tr8nhub @theiceberk
Q&A

More Related Content

What's hot

Introduct To C Language Programming
Introduct To C Language ProgrammingIntroduct To C Language Programming
Introduct To C Language Programmingyarkhosh
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golangBasil N G
 
B-Translator as a Software Engineering Project
B-Translator as a Software Engineering ProjectB-Translator as a Software Engineering Project
B-Translator as a Software Engineering ProjectDashamir Hoxha
 
Ch1 language design issue
Ch1 language design issueCh1 language design issue
Ch1 language design issueJigisha Pandya
 
Programing language
Programing languagePrograming language
Programing languageJames Taylor
 
Go language presentation
Go language presentationGo language presentation
Go language presentationparamisoft
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingGwyneth Calica
 
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180Mahmoud Samir Fayed
 
From Programming to Modeling And Back Again
From Programming to Modeling And Back AgainFrom Programming to Modeling And Back Again
From Programming to Modeling And Back AgainMarkus Voelter
 
Computer Language Translator
Computer Language TranslatorComputer Language Translator
Computer Language TranslatorRanjeet Kumar
 
Language processor
Language processorLanguage processor
Language processorAbha Damani
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothBhavsingh Maloth
 
Imperative programming
Imperative programmingImperative programming
Imperative programmingEdward Blurock
 
Language processors
Language processorsLanguage processors
Language processorseShikshak
 

What's hot (19)

Introduct To C Language Programming
Introduct To C Language ProgrammingIntroduct To C Language Programming
Introduct To C Language Programming
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
B-Translator as a Software Engineering Project
B-Translator as a Software Engineering ProjectB-Translator as a Software Engineering Project
B-Translator as a Software Engineering Project
 
Ch1 language design issue
Ch1 language design issueCh1 language design issue
Ch1 language design issue
 
Programing language
Programing languagePrograming language
Programing language
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Programing Language
Programing LanguagePrograming Language
Programing Language
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
 
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
 
From Programming to Modeling And Back Again
From Programming to Modeling And Back AgainFrom Programming to Modeling And Back Again
From Programming to Modeling And Back Again
 
Computer Language Translator
Computer Language TranslatorComputer Language Translator
Computer Language Translator
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
Language processor
Language processorLanguage processor
Language processor
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
 
DMA113 Chap1
DMA113 Chap1DMA113 Chap1
DMA113 Chap1
 
Imperative programming
Imperative programmingImperative programming
Imperative programming
 
Language processors
Language processorsLanguage processors
Language processors
 

Similar to Tr8n for php - Michael Berkovich

State of the Machine Translation by Intento (November 2017)
State of the Machine Translation by Intento (November 2017)State of the Machine Translation by Intento (November 2017)
State of the Machine Translation by Intento (November 2017)Konstantin Savenkov
 
TEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityTEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityLinaro
 
Not my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureNot my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureYshay Yaacobi
 
State of the Machine Translation by Intento (March 2018)
State of the Machine Translation by Intento (March 2018)State of the Machine Translation by Intento (March 2018)
State of the Machine Translation by Intento (March 2018)Konstantin Savenkov
 
Drupal 7 multilingual strategy
Drupal 7 multilingual strategyDrupal 7 multilingual strategy
Drupal 7 multilingual strategyMariano
 
Translation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation MemoryTranslation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation MemoryMichael Berkovich
 
Mx trans pack_instructions
Mx trans pack_instructionsMx trans pack_instructions
Mx trans pack_instructionsMX Community
 
Introduction to domino_global_workbench_8.5
Introduction to domino_global_workbench_8.5Introduction to domino_global_workbench_8.5
Introduction to domino_global_workbench_8.5hepeiwei
 
Chap 1-language processor
Chap 1-language processorChap 1-language processor
Chap 1-language processorshindept123
 
From class to architecture
From class to architectureFrom class to architecture
From class to architectureMarcin Hawraniak
 
Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Suzanne Dergacheva
 
Localization: How to do a global project
Localization: How to do a global projectLocalization: How to do a global project
Localization: How to do a global projectAlconost
 
The Ring programming language version 1.4.1 book - Part 2 of 31
The Ring programming language version 1.4.1 book - Part 2 of 31The Ring programming language version 1.4.1 book - Part 2 of 31
The Ring programming language version 1.4.1 book - Part 2 of 31Mahmoud Samir Fayed
 
Engineering Your Product Information for Local Markets
Engineering Your Product Information for Local MarketsEngineering Your Product Information for Local Markets
Engineering Your Product Information for Local MarketsTom Knupp
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overviewamudha arul
 
UNIT-2web technologybchelor .pptx
UNIT-2web technologybchelor        .pptxUNIT-2web technologybchelor        .pptx
UNIT-2web technologybchelor .pptxnidhidube10
 
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Andrew Yatsenko
 
The Ring programming language version 1.4 book - Part 2 of 30
The Ring programming language version 1.4 book - Part 2 of 30The Ring programming language version 1.4 book - Part 2 of 30
The Ring programming language version 1.4 book - Part 2 of 30Mahmoud Samir Fayed
 

Similar to Tr8n for php - Michael Berkovich (20)

State of the Machine Translation by Intento (November 2017)
State of the Machine Translation by Intento (November 2017)State of the Machine Translation by Intento (November 2017)
State of the Machine Translation by Intento (November 2017)
 
TEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityTEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source security
 
Not my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureNot my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructure
 
State of the Machine Translation by Intento (March 2018)
State of the Machine Translation by Intento (March 2018)State of the Machine Translation by Intento (March 2018)
State of the Machine Translation by Intento (March 2018)
 
Go at uber
Go at uberGo at uber
Go at uber
 
Drupal 7 multilingual strategy
Drupal 7 multilingual strategyDrupal 7 multilingual strategy
Drupal 7 multilingual strategy
 
Translation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation MemoryTranslation Markup Language and Universal Translation Memory
Translation Markup Language and Universal Translation Memory
 
Mx trans pack_instructions
Mx trans pack_instructionsMx trans pack_instructions
Mx trans pack_instructions
 
Edge and ai
Edge and aiEdge and ai
Edge and ai
 
Introduction to domino_global_workbench_8.5
Introduction to domino_global_workbench_8.5Introduction to domino_global_workbench_8.5
Introduction to domino_global_workbench_8.5
 
Chap 1-language processor
Chap 1-language processorChap 1-language processor
Chap 1-language processor
 
From class to architecture
From class to architectureFrom class to architecture
From class to architecture
 
Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7
 
Localization: How to do a global project
Localization: How to do a global projectLocalization: How to do a global project
Localization: How to do a global project
 
The Ring programming language version 1.4.1 book - Part 2 of 31
The Ring programming language version 1.4.1 book - Part 2 of 31The Ring programming language version 1.4.1 book - Part 2 of 31
The Ring programming language version 1.4.1 book - Part 2 of 31
 
Engineering Your Product Information for Local Markets
Engineering Your Product Information for Local MarketsEngineering Your Product Information for Local Markets
Engineering Your Product Information for Local Markets
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
UNIT-2web technologybchelor .pptx
UNIT-2web technologybchelor        .pptxUNIT-2web technologybchelor        .pptx
UNIT-2web technologybchelor .pptx
 
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
 
The Ring programming language version 1.4 book - Part 2 of 30
The Ring programming language version 1.4 book - Part 2 of 30The Ring programming language version 1.4 book - Part 2 of 30
The Ring programming language version 1.4 book - Part 2 of 30
 

More from Caroline_Rose

Simon Jia - The Kohana Framework
Simon Jia - The Kohana FrameworkSimon Jia - The Kohana Framework
Simon Jia - The Kohana FrameworkCaroline_Rose
 
Peter Zaitsev - Practical MySQL Performance Optimization
Peter Zaitsev - Practical MySQL Performance OptimizationPeter Zaitsev - Practical MySQL Performance Optimization
Peter Zaitsev - Practical MySQL Performance OptimizationCaroline_Rose
 
Semantic webslideshareversion
Semantic webslideshareversionSemantic webslideshareversion
Semantic webslideshareversionCaroline_Rose
 
Shaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's API
Shaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's APIShaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's API
Shaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's APICaroline_Rose
 
My sql with enterprise storage
My sql with enterprise storageMy sql with enterprise storage
My sql with enterprise storageCaroline_Rose
 

More from Caroline_Rose (6)

Simon Jia - The Kohana Framework
Simon Jia - The Kohana FrameworkSimon Jia - The Kohana Framework
Simon Jia - The Kohana Framework
 
Peter Zaitsev - Practical MySQL Performance Optimization
Peter Zaitsev - Practical MySQL Performance OptimizationPeter Zaitsev - Practical MySQL Performance Optimization
Peter Zaitsev - Practical MySQL Performance Optimization
 
Dal deck
Dal deckDal deck
Dal deck
 
Semantic webslideshareversion
Semantic webslideshareversionSemantic webslideshareversion
Semantic webslideshareversion
 
Shaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's API
Shaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's APIShaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's API
Shaddy Zeineddine: Queuing w/ MongoDB & BreakMedia's API
 
My sql with enterprise storage
My sql with enterprise storageMy sql with enterprise storage
My sql with enterprise storage
 

Recently uploaded

GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncObject Automation
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?SANGHEE SHIN
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIUdaiappa Ramachandran
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfAnna Loughnan Colquhoun
 

Recently uploaded (20)

GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdf
 

Tr8n for php - Michael Berkovich

  • 1. Tr8n for PHP Crowdsourced Translations Presented by Michael Berkovich michael@tr8nhub.com https://github.com/tr8n/tr8n_php_clientsdk
  • 2. About Me ● Software Engineer at Digital Evolution, US Interactive, SOA Software, Geni, Yammer ● Creator of Tr8n translation framework ● Founder and CTO at Tr8nHub.com
  • 3. What is Tr8n? Tr8n = Tr[anslatio]n pronounced “tr - 8 - n” Translation framework, platform, technology.
  • 4. Tr8n Timeline 2009 Started as a Ruby library to translate Geni.com to 70 languages. 2010 RoR Gem is created and adopted by Yammer and a number of companies around the world. Tr8n Gem is open sourced. 2013 Tr8nHub server (beta) is launched as a shared Translation Memory and Language Rule Repository. 2014 Ruby, PHP, Objective C, JavaScript, C# and Java SDK libraries are added to support all major platforms.
  • 5. Tr8n Core Features ● Translation Markup Language (TML) ● Rules Engine with Centralized Repository ● Shared Translation Memory (TM)
  • 6. Additional Features ● ● ● ● ● ● ● No resource bundles Support for over 300 languages Crowdsourced translation tools Inline and bulk translation modes Intuitive user interface and admin tools Custom translation workflows Glossaries, forums, etc...
  • 7. Your Application PHP, Rails, Java, iOS, JavaScript, Python, Perl, .Net, etc... Tr8n SDK Tr8n SDK + Tr8nHub API Tr8nHub.com TM, Rules, UI Widgets, Workflows, Management, etc... Cache Files, APC, Memcache, Redis, CHDB, DB,...
  • 8. Tr8n SDKs ● API Client ● Rules Engine + TML ● Cache Adapters
  • 9. Tr8nHub Platform ● ● ● ● ● Translation Management User Interface and Widgets Shared Translation Memory Translator Tools Workflows, etc...
  • 11. Why Crowdsourcing? ● Use your own users to translate your application ● No “Golden Gate Bridge Syndrome” ● Self-monitoring and auditing system ● Low cost for adding new languages
  • 12. Tr8n Ranking Systems Translation rank - total sum of all positive and negative votes for a translation Application threshold - the minimum translation rank to be displayed in an application Translator rank - a ratio between the total submitted translations and accepted translations
  • 13. Translation Rank ● When user adds a translation, it automatically gets +1 vote/rank ● User can only submit one vote for each translation ● Other users can vote +1 or -1 per translation ● Total sum of all +1 and -1 is the rank of the translation
  • 14. Application Threshold ● Threshold controls which translations will be used in the application ● Lower number allows for more aggressive translations ● Higher number requires more users to vote before the translation is accepted ● Users may have different voting powers based on their ranks and levels
  • 15. Translation Monitoring ● Each translation is checked against dirty word filters ● Bad translations are rejected and translators are put on the watch list ● Reported translations are not deleted, but voted -100 points ● Admin tools allow for close monitoring of the progress and identify violations
  • 16. Translation States Accepted - translation rank is above the application threshold Pending - translation rank is between 0 and the application threshold Rejected - translation rank is below 0
  • 17. Levels & Permissions ● Each translation key and translator has a level ● By default all keys and all translators have level 0 ● Translators can only translate keys at their level or below ● Levels can be assigned to keys and translators, or to entire sections of the app
  • 18. Translator Rank ● Calculated every time translations are voted up or down ● Reporting a translation puts a translator on a watch list ● Translators can be blocked by admins and their translations can be automatically suspended or rejected
  • 19. Managers ● Translators can be promoted to managers ● Managers get higher voting power ● Managers can configure application setting and language rules
  • 20. Translation Key Locks ● Managers can lock and unlock translation keys for a specific language ● Locked keys will no longer be available for translation ● Reporting a translation for a translation key can unlock the key
  • 22. Supported Platforms ● ● ● ● ● ● ● PHP (>= 5.3) Ruby on Rails (>= 3.2) JavaScript Objective C, iOS (>= 6.2) Java (work in progress) Python (work in progress) .Net, C# (work in progress)
  • 23. Install Composer $ cd PROJECT_FOLDER $ curl -s http://getcomposer.org/installer | php
  • 24. Configure Composer Create composer.json file with the following: { "require": { "tr8n/tr8n-client-sdk": "dev-master" } }
  • 25. Install Vendor Packages $ php composer.phar install
  • 27. Sample PHP File <?php require_once(__DIR__ . '/vendor/tr8n/tr8n-client-sdk/library/Tr8n.php'); ?> <?php tr8n_init_client_sdk("https://tr8nhub.com", your_app_key, your_app_secret); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo tr8n_current_language()->locale ?>" dir="<?php echo tr8n_current_language()->direction ?>"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <?php include(__DIR__ . '/vendor/tr8n/tr8n-client-sdk/library/Tr8n/Includes/Scripts.php'); ?> </head> <body> <?php tre("Hello World") ?> </body> </html> <?php tr8n_complete_request() ?>
  • 29. Translation Markup Language ● Simple and extensible syntax ● Platform and technology independent ● Improves code readability ● Code completion support is coming...
  • 30. TML Modes ● Simple TML ○ Used by beginner and intermediate translators ● Advanced TML ○ Available through TML extensions ○ Used by developers and advanced translators
  • 32. Translation Method <?php echo tr($label, $description = "", $tokens = array(), $options = array()) ? > ● $label - required string ● $description - optional context of the label ● $tokens - optional hash of tokens; required if tokens are used in the label ● $options - optional array of options
  • 33. Alternatives <?php echo tr($label, $tokens = array(), $options = array()) ?> <?php echo tr(array( “label” => “”, “description” => “”, “tokens” => array(), “options” => array() ) ) ?>
  • 34. Additional Methods ● tre(...) - automatically echos the result ● trl(...) - disables inline translations; used for options and alt tags ● trle(...) - same as trl without inline translations <img src=”picture.png” alt=”<?php trle(‘Profile photo’) ?>”>
  • 35. Label Description Are these the same? <?php tre(“Home”, “Place of residence”) ?> vs <?php tre(“Home”, “Main page of the site”) ?>
  • 36. Label Description ● The description is not mandatory, but it should be used when the label is ambiguous ● Tr8n uses label and description together to create a unique key for each translation key ● The description serves a hint to the translators for the context in which the key was used
  • 38. TML Tokens ● ● ● ● ● Dynamic data substitution Minimize the number of translation keys Maximize translation key reuse Decorate translation key elements Nest translations (but don’t take them out of context)
  • 39. TML Token Types ● Data Tokens ○ Curly brackets with a name of a token ○ {token_name:type::case} ○ Supports extensions (Pipes and Methods tokens) ● Decoration Tokens ○ Square brackets with a name of a decoration ○ [token_name] value_to_be_decorated [/token_name] ○ [token_name: value_to_be_decorated]
  • 41. Other Features Blocks ○ ○ Provide a mechanism to specify options to all nested translation calls Can be nested Sources ○ Allow grouping of translation keys per page, include, or any structure Components ○ Groups of sources assigned to translators for specific languages
  • 43. Tr8n Caching ● Tr8n API is only used in translation mode and in a cache warm-up mode ● In all other cases all data is served from local cache ● SDKs have a mechanism to invalidate and rebuild cache
  • 44. Supported Cache Adapters ● ● ● ● ● Files (JSON or YAML) APC Memcached (Memcache) Redis CHDB ● Easy to add others
  • 45. Resources ● ● ● ● ● Tr8nHub service ○ https://tr8nhub.com Documentation ○ http://wiki.tr8nhub.com Blog ○ http://blog.tr8nhub.com SDK Source Code ○ https://github.com/tr8n/tr8n_php_clientsdk PHP Sample Service ○ http://php.tr8nhub.com My Email: michael@tr8nhub.com Twitter: @tr8nhub @theiceberk
  • 46. Q&A