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