SlideShare una empresa de Scribd logo
1 de 38
Data Localization and Translation
Data Localization
and
Translation
Yevhen Shyshkin
yshyshkin@orocrm.com
https://github.com/yshyshkin
Data Localization and Translation
Language localisation is the process of
adapting a product that has been previously
translated into different languages to a
specific country or region.
What is language localization?
Data Localization and Translation
Where localization is applied?
- Name formatting
- Address formatting
- Datetime formatting
- Number formatting
- Decimal
- Integer
- Percent
- Currency
Data Localization and Translation
Localization configuration
System > Configuration > Localization
Data Localization and Translation
Localization configuration
$this->get('oro_locale.settings')->getLocale();
$this->get('oro_locale.settings')->getCurrency();
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Model/LocaleSettings.php
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/locale-
settings.js
Result: en
USD
PHP:
JS: require(['orolocale/js/locale-settings'],
function(localeSettings) {
localeSettings.getLocale();
localeSettings.getCurrency();
});
Twig: {{ oro_locale() }}
{{ oro_currency() }}
Data Localization and Translation
Name formatting
- Names are formatted based on locale
- Name format configuration can be defined in
any bundle’s YAML file
Resources/config/oro/name_format.yml
- Format may contain placeholders for name
prefix, name suffix, first name,
last name and middle name
- Entity must include OroBundle
LocaleBundleModelFullNameInterface
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Model/FullNameInterface.php
Data Localization and Translation
Name formatting
en: %prefix% %first_name% %middle_name% %last_name% %suffix%
en_US: %prefix% %first_name% %middle_name% %last_name% %suffix%
ru: %last_name% %first_name% %middle_name%
ru_RU: %last_name% %first_name% %middle_name%
Configuration example
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/config/oro/na
me_format.yml
Data Localization and Translation
Name formatting
$user = new User(); // implements FullNameInterface
$user->setNamePrefix('Mr.')
->setFirstName('John')
->setMiddleName('S.')
->setLastName('Doe')
->setNameSuffix('Jr.');
$this->get('oro_locale.formatter.name')->format($user);
$this->get('oro_locale.formatter.name')->format($user, 'ru');
PHP:
Twig: {{ entity|oro_format_name }}
{{ entity|oro_format_name('ru') }}
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/NameFormatter.php
Data Localization and Translation
Name formatting
require(['orolocale/js/formatter/name'],
function(nameFormatter) {
var user = {
'prefix': 'Mr.',
'first_name': 'John',
'middle_name': 'S.',
'last_name': 'Doe',
'suffix': 'Jr'
};
nameFormatter.format(user);
nameFormatter.format(user, 'ru');
});
JS:
Result: Mr. John S. Doe Jr.
Doe John S.
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/na
me.js
Data Localization and Translation
Address formatting
- Addresses are formatted based on primary
location or country address
- Address format configuration can be defined in
any bundle’s YAML file
Resources/config/oro/address_format.yml
- Format may contain placeholders for name,
organization, street, city, region, region code,
country, country code and postal code
- Entity must include OroBundle
LocaleBundleModelAddressInterface
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Model/AddressInterface.php
Data Localization and Translation
Address formatting
US:
format: '%name%n%organization%n%street%n%CITY% %REGION_CODE%
%COUNTRY_ISO2% %postal_code%'
require: [street, city, region, postal_code]
zip_name_type: zip
region_name_type: region
RU:
format: '%postal_code% %COUNTRY%
%CITY%n%STREET%n%organization%n%name%'
require: [street, city, postal_code]
Configuration example
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/config/oro/ad
dress_format.yml
Data Localization and Translation
Address formatting
$country = new Country('US');
$country->setName('United States of America')
->setIso3Code('USA');
$region = new Region('US-CA');
$region->setCode('CA')
->setName('California');
$address = new Address(); // implements AddressInterface
$address->setNamePrefix('Mr.')
->setFirstName('John')
->setMiddleName('S.')
->setLastName('Doe')
->setNameSuffix('Jr.');
$address->setStreet('Random str., 3, 14')
->setCity('Los Angeles')
->setRegion($region)
->setCountry($country)
->setPostalCode('12345')
->setOrganization('Oro Inc.');
$this->get('oro_locale.formatter.address')->format($address);
PHP:
Data Localization and Translation
Address formatting
Twig: {{ address|oro_format_address|nl2br }}
require(['orolocale/js/formatter/address'],
function(addressFormatter) {
var address = {
'prefix': 'Mr.',
'first_name': 'John',
'middle_name': 'S.',
'last_name': 'Doe',
'suffix': 'Jr',
'organization': 'Oro Inc.',
'street': 'Random str., 3, 14',
'city': 'Los Angeles',
'region_code': 'CA',
'country_iso2': 'US',
'postal_code': '12345'
};
addressFormatter.format(address);
});
JS:
Data Localization and Translation
Address formatting
Result: Mr. John S. Doe Jr.
Oro Inc.
Random str., 3, 14
LOS ANGELES CA US 12345
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/AddressFormatter.php
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/addr
ess.js
Data Localization and Translation
Datetime formatting
- Datetime values are formatted based on locale,
timezone and type (none, short, medium, long,
full)
- Datetime format configuration extracted from
libicu via PHP INTL extension
- Datetime formatter accepts DateTime object,
string and timestamp values
Data Localization and Translation
Datetime formatting
PHP: $dateTime = new DateTime(
'2011-12-13 14:15:16',
new DateTimeZone('UTC')
);
$formatter = $this->get('oro_locale.formatter.date_time');
$formatter->format($dateTime);
$formatter->formatDate($dateTime->format('Y-m-d'));
$formatter->formatTime($dateTime->getTimestamp());
Result: Dec 13, 2011 4:15 PM
Dec 13, 2011
4:15 PM
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/DateTimeFormatter.php
Data Localization and Translation
Datetime formatting
JS: require(['orolocale/js/formatter/datetime'],
function(datetimeFormatter) {
datetimeFormatter.formatDateTime('2011-12-13T14:15:16+0000');
datetimeFormatter.formatDate('2011-12-13');
datetimeFormatter.formatTime('14:15:16');
});
Twig: {{ '2011-12-13 14:15:16'|oro_format_datetime }}
{{ '2011-12-13'|oro_format_date }}
{{ '14:15:16'|oro_format_time }}
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/da
tetime.js
Result: Dec 13, 2011 4:15 PM
Dec 13, 2011
2:15 PM
Data Localization and Translation
Datetime format handling
- Different libraries use different datetime formats
- Oro Platform provides format converters for
libicu, moment.js and jquery.ui
- New formatters can be registered using DI tag
oro_locale.format_converter.date_time
Data Localization and Translation
Datetime timezone handling
- To simplify timezone handling all DateTime
object in the backend should be in UTC
timezone
- DateTime objects saved to the DB and
extracted from the DB are automatically
converted to UTC timezone
- Formatting of DateTime objects should be
performed using DateTimeConverter via
service oro_locale.formatter.date_time
Data Localization and Translation
Number formatting
- Numbers are formatted based on locale
- Formatter works with decimal, percent, currency,
spellout, duration and ordinal values
- Number format configuration extracted from
libicu via PHP INTL extension
- Currency use symbols from YAML files
Resources/config/oro/currency_data.yml
Data Localization and Translation
Number formatting
$formatter = $this->get('oro_locale.formatter.number');
$formatter->formatDecimal(12345.6789);
$formatter->formatDecimal(12345);
$formatter->formatPercent(1.2345);
$formatter->formatCurrency(12345.6789);
$formatter->formatCurrency(12345.6789, 'EUR');
PHP:
Twig: {{ 12345.6789|oro_format_decimal }}
{{ 12345|oro_format_decimal }}
{{ 1.2345|oro_format_percent }}
{{ 12345.6789|oro_format_currency }}
{{ 12345.6789|oro_format_currency({'currency':'EUR'}) }}
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/NumberFormatter.php
Data Localization and Translation
Number formatting
require(['orolocale/js/formatter/number'],
function(numberFormatter) {
numberFormatter.formatDecimal(12345.6789);
numberFormatter.formatInteger(12345);
numberFormatter.formatPercent(1.2345);
numberFormatter.formatCurrency(12345.6789);
numberFormatter.formatCurrency(12345.6789, 'EUR');
});
JS:
Result: 12,345.679
12,345
123.45%
$12,345.68
€12,345.68
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/nu
mber.js
Data Localization and Translation
Localization CLI commands
oro:localization:dump - dump localization
configuration from YAML files to
web/js/oro.locale_data.js
Data Localization and Translation
Translation is the communication of the
meaning of a source-language text by
means of an equivalent target-language text.
What is translation?
Data Localization and Translation
Oro Platform use standard Symfony2 mechanism
to perform frontend translation in PHP, in Twig
templates, and translator.js library from
BazingaJsTranslationBundle
Translations are stored in YAML files in any bundle
and in the application database.
How translations used in
Oro Platform?
Data Localization and Translation
- messages - common messages used both for
system and custom purposes
- validators - validation messages
- jsmessages - messages translated on frontend
side
- tooltips - messages for and form field tooltips
- entity - data for entities translated with Gedmo
translatable extension
Translation domains
Data Localization and Translation
Recommended
translation message format
<application>.<bundle>.<section>.<key>
oro.user.form.choose_gender
oro.dataaudit.change_history.title
oro.entity_config.menu.entities_list.label
Format:
Examples:
Data Localization and Translation
Translation extractors
- PhpCodeExtractor - extracts formatted
strings from PHP code
- NavigationTranslationExtractor -
extracts title translations from
navigation.yml files
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Extractor/PhpCodeEx
tractor.php
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/NavigationBundle/Title/TranslationExtrac
tor.php
Data Localization and Translation
Translation on backend
$this->get('translator')->trans('oro.dashboard.title.main');
$this->get('translator')->trans('oro.entity.item', ['%id%' => 42]);
PHP:
Twig: {{ 'oro.dashboard.title.main'|trans }}
{{ 'oro.entity.item'|trans({'%id%': 42}) }}
Result: Dashboard
Item #42
# messages.en.yml
oro.dashboard.title.main: "Dashboard"
oro.entity.item: "Item #%id%"
YAML:
Data Localization and Translation
Translation on frontend
require(['orotranslation/js/translator'],
function(__) {
__('oro.note.add_note_title');
__('oro.datagrid.pagination.totalRecords', {totalRecords: 42});
});
JS:
Result: Add note
Total of 42 records
# jsmessages.en.yml
oro.note.add_note_title: "Add note"
oro.datagrid.pagination:
totalRecords: "Total of {{ totalRecords }} records"
YAML:
Data Localization and Translation
Translation in the database
- table oro_translation
- entity OroTranslationBundle:Translation
- scopes SYSTEM and UI
# id
# key
# value
# locale
# domain
# scope
Translation
Data Localization and Translation
Translation in database
- OrmTranslationLoader - loads
translations from database
- DatabasePersister - persists translations
to database
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Translation/Or
mTranslationLoader.php
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Translation/Da
tabasePersister.php
Data Localization and Translation
Translation configuration
System > Configuration > Language settings
Data Localization and Translation
Interaction with Crowdin
- Dump translations from translation extractors
and YAML files
- Download translations from Crowdin
- Merge them with existing translations
- Upload updated translations to Crowdin
Oro Platform Crowdin
1. dump 2. download
3. merge
4. upload
Data Localization and Translation
Debug translator
- Wraps translated strings in square brackets -
[<string>]
- Wraps not translated strings into exclamation
marks - !!!---string---!!!
- Add JS prefix for frontend translations
- can be enabled in app/config/config.yml
oro_translation:
debug_translator: true
https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Translation/De
bugTranslator.php
Data Localization and Translation
Debug translator
Data Localization and Translation
Translation CLI commands
oro:translation:dump - dumps frontend
translations into web/js/translation/<locale>.js
oro:translation:pack - extracts translation files
for each bundle in specified vendor namespace
and creates language pack
Data Localization and Translation
Questions
and
Answers

Más contenido relacionado

La actualidad más candente

JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag LibraryIlio Catallo
 
Building Data Mapper PHP5
Building Data Mapper PHP5Building Data Mapper PHP5
Building Data Mapper PHP5Vance Lucas
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3Jeremy Coates
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and DeploymentBG Java EE Course
 
JSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLJSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLseleciii44
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSCarol McDonald
 
JavaScript
JavaScriptJavaScript
JavaScriptSunil OS
 
JAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) BridgeJAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) BridgeJosé Paumard
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rackdanwrong
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHPRob Knight
 
Web注入+http漏洞等描述
Web注入+http漏洞等描述Web注入+http漏洞等描述
Web注入+http漏洞等描述fangjiafu
 
03 form-data
03 form-data03 form-data
03 form-datasnopteck
 

La actualidad más candente (20)

Slim Framework
Slim FrameworkSlim Framework
Slim Framework
 
55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
Jstl Guide
Jstl GuideJstl Guide
Jstl Guide
 
JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag Library
 
Building Data Mapper PHP5
Building Data Mapper PHP5Building Data Mapper PHP5
Building Data Mapper PHP5
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
JSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLJSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTL
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) BridgeJAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) Bridge
 
PHP - Introduction to PHP Date and Time Functions
PHP -  Introduction to  PHP Date and Time FunctionsPHP -  Introduction to  PHP Date and Time Functions
PHP - Introduction to PHP Date and Time Functions
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHP
 
Core Java - Quiz Questions - Bug Hunt
Core Java - Quiz Questions - Bug HuntCore Java - Quiz Questions - Bug Hunt
Core Java - Quiz Questions - Bug Hunt
 
Web注入+http漏洞等描述
Web注入+http漏洞等描述Web注入+http漏洞等描述
Web注入+http漏洞等描述
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
03 form-data
03 form-data03 form-data
03 form-data
 
Java JDBC
Java JDBCJava JDBC
Java JDBC
 
Quebec pdo
Quebec pdoQuebec pdo
Quebec pdo
 

Similar a Data Localization and Translation

I18n
I18nI18n
I18nsoon
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsPierre MARTIN
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)James Titcumb
 
Zend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessionsZend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessionsTricode (part of Dept)
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 
Migrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifierMigrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifierClayton Parker
 
Symfony CMF - PHP Conference Brazil 2011
Symfony CMF - PHP Conference Brazil 2011Symfony CMF - PHP Conference Brazil 2011
Symfony CMF - PHP Conference Brazil 2011Jacopo Romei
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL Suraj Bang
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersKacper Gunia
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
The Ruby On Rails I18n Core Api
The Ruby On Rails I18n Core ApiThe Ruby On Rails I18n Core Api
The Ruby On Rails I18n Core ApiNTT DATA Americas
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
Rapid Prototyping with PEAR
Rapid Prototyping with PEARRapid Prototyping with PEAR
Rapid Prototyping with PEARMarkus Wolff
 
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)James Titcumb
 
Internationalization with TYPO3
Internationalization with TYPO3Internationalization with TYPO3
Internationalization with TYPO3digiparden GmbH
 
How to Get Your Website Into the Cloud
How to Get Your Website Into the CloudHow to Get Your Website Into the Cloud
How to Get Your Website Into the CloudAll Things Open
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesOry Segal
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsDylan Jay
 

Similar a Data Localization and Translation (20)

I18n
I18nI18n
I18n
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
 
Zend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessionsZend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessions
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Migrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifierMigrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifier
 
Symfony CMF - PHP Conference Brazil 2011
Symfony CMF - PHP Conference Brazil 2011Symfony CMF - PHP Conference Brazil 2011
Symfony CMF - PHP Conference Brazil 2011
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
The Ruby On Rails I18n Core Api
The Ruby On Rails I18n Core ApiThe Ruby On Rails I18n Core Api
The Ruby On Rails I18n Core Api
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Rapid Prototyping with PEAR
Rapid Prototyping with PEARRapid Prototyping with PEAR
Rapid Prototyping with PEAR
 
PHP and COM
PHP and COMPHP and COM
PHP and COM
 
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
 
Internationalization with TYPO3
Internationalization with TYPO3Internationalization with TYPO3
Internationalization with TYPO3
 
How to Get Your Website Into the Cloud
How to Get Your Website Into the CloudHow to Get Your Website Into the Cloud
How to Get Your Website Into the Cloud
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web apps
 

Más de Yevhen Shyshkin

Development Guide for Beginners
Development Guide for BeginnersDevelopment Guide for Beginners
Development Guide for BeginnersYevhen Shyshkin
 
Advanced Search with Elasticsearch
Advanced Search with ElasticsearchAdvanced Search with Elasticsearch
Advanced Search with ElasticsearchYevhen Shyshkin
 
E-Commerce search with Elasticsearch
E-Commerce search with ElasticsearchE-Commerce search with Elasticsearch
E-Commerce search with ElasticsearchYevhen Shyshkin
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best PracticesYevhen Shyshkin
 

Más de Yevhen Shyshkin (6)

Development Guide for Beginners
Development Guide for BeginnersDevelopment Guide for Beginners
Development Guide for Beginners
 
Advanced Search with Elasticsearch
Advanced Search with ElasticsearchAdvanced Search with Elasticsearch
Advanced Search with Elasticsearch
 
E-Commerce search with Elasticsearch
E-Commerce search with ElasticsearchE-Commerce search with Elasticsearch
E-Commerce search with Elasticsearch
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
Transactions etc
Transactions etcTransactions etc
Transactions etc
 
Oro Workflows
Oro WorkflowsOro Workflows
Oro Workflows
 

Último

What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 

Último (20)

What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 

Data Localization and Translation

  • 1. Data Localization and Translation Data Localization and Translation Yevhen Shyshkin yshyshkin@orocrm.com https://github.com/yshyshkin
  • 2. Data Localization and Translation Language localisation is the process of adapting a product that has been previously translated into different languages to a specific country or region. What is language localization?
  • 3. Data Localization and Translation Where localization is applied? - Name formatting - Address formatting - Datetime formatting - Number formatting - Decimal - Integer - Percent - Currency
  • 4. Data Localization and Translation Localization configuration System > Configuration > Localization
  • 5. Data Localization and Translation Localization configuration $this->get('oro_locale.settings')->getLocale(); $this->get('oro_locale.settings')->getCurrency(); https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Model/LocaleSettings.php https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/locale- settings.js Result: en USD PHP: JS: require(['orolocale/js/locale-settings'], function(localeSettings) { localeSettings.getLocale(); localeSettings.getCurrency(); }); Twig: {{ oro_locale() }} {{ oro_currency() }}
  • 6. Data Localization and Translation Name formatting - Names are formatted based on locale - Name format configuration can be defined in any bundle’s YAML file Resources/config/oro/name_format.yml - Format may contain placeholders for name prefix, name suffix, first name, last name and middle name - Entity must include OroBundle LocaleBundleModelFullNameInterface https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Model/FullNameInterface.php
  • 7. Data Localization and Translation Name formatting en: %prefix% %first_name% %middle_name% %last_name% %suffix% en_US: %prefix% %first_name% %middle_name% %last_name% %suffix% ru: %last_name% %first_name% %middle_name% ru_RU: %last_name% %first_name% %middle_name% Configuration example https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/config/oro/na me_format.yml
  • 8. Data Localization and Translation Name formatting $user = new User(); // implements FullNameInterface $user->setNamePrefix('Mr.') ->setFirstName('John') ->setMiddleName('S.') ->setLastName('Doe') ->setNameSuffix('Jr.'); $this->get('oro_locale.formatter.name')->format($user); $this->get('oro_locale.formatter.name')->format($user, 'ru'); PHP: Twig: {{ entity|oro_format_name }} {{ entity|oro_format_name('ru') }} https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/NameFormatter.php
  • 9. Data Localization and Translation Name formatting require(['orolocale/js/formatter/name'], function(nameFormatter) { var user = { 'prefix': 'Mr.', 'first_name': 'John', 'middle_name': 'S.', 'last_name': 'Doe', 'suffix': 'Jr' }; nameFormatter.format(user); nameFormatter.format(user, 'ru'); }); JS: Result: Mr. John S. Doe Jr. Doe John S. https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/na me.js
  • 10. Data Localization and Translation Address formatting - Addresses are formatted based on primary location or country address - Address format configuration can be defined in any bundle’s YAML file Resources/config/oro/address_format.yml - Format may contain placeholders for name, organization, street, city, region, region code, country, country code and postal code - Entity must include OroBundle LocaleBundleModelAddressInterface https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Model/AddressInterface.php
  • 11. Data Localization and Translation Address formatting US: format: '%name%n%organization%n%street%n%CITY% %REGION_CODE% %COUNTRY_ISO2% %postal_code%' require: [street, city, region, postal_code] zip_name_type: zip region_name_type: region RU: format: '%postal_code% %COUNTRY% %CITY%n%STREET%n%organization%n%name%' require: [street, city, postal_code] Configuration example https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/config/oro/ad dress_format.yml
  • 12. Data Localization and Translation Address formatting $country = new Country('US'); $country->setName('United States of America') ->setIso3Code('USA'); $region = new Region('US-CA'); $region->setCode('CA') ->setName('California'); $address = new Address(); // implements AddressInterface $address->setNamePrefix('Mr.') ->setFirstName('John') ->setMiddleName('S.') ->setLastName('Doe') ->setNameSuffix('Jr.'); $address->setStreet('Random str., 3, 14') ->setCity('Los Angeles') ->setRegion($region) ->setCountry($country) ->setPostalCode('12345') ->setOrganization('Oro Inc.'); $this->get('oro_locale.formatter.address')->format($address); PHP:
  • 13. Data Localization and Translation Address formatting Twig: {{ address|oro_format_address|nl2br }} require(['orolocale/js/formatter/address'], function(addressFormatter) { var address = { 'prefix': 'Mr.', 'first_name': 'John', 'middle_name': 'S.', 'last_name': 'Doe', 'suffix': 'Jr', 'organization': 'Oro Inc.', 'street': 'Random str., 3, 14', 'city': 'Los Angeles', 'region_code': 'CA', 'country_iso2': 'US', 'postal_code': '12345' }; addressFormatter.format(address); }); JS:
  • 14. Data Localization and Translation Address formatting Result: Mr. John S. Doe Jr. Oro Inc. Random str., 3, 14 LOS ANGELES CA US 12345 https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/AddressFormatter.php https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/addr ess.js
  • 15. Data Localization and Translation Datetime formatting - Datetime values are formatted based on locale, timezone and type (none, short, medium, long, full) - Datetime format configuration extracted from libicu via PHP INTL extension - Datetime formatter accepts DateTime object, string and timestamp values
  • 16. Data Localization and Translation Datetime formatting PHP: $dateTime = new DateTime( '2011-12-13 14:15:16', new DateTimeZone('UTC') ); $formatter = $this->get('oro_locale.formatter.date_time'); $formatter->format($dateTime); $formatter->formatDate($dateTime->format('Y-m-d')); $formatter->formatTime($dateTime->getTimestamp()); Result: Dec 13, 2011 4:15 PM Dec 13, 2011 4:15 PM https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/DateTimeFormatter.php
  • 17. Data Localization and Translation Datetime formatting JS: require(['orolocale/js/formatter/datetime'], function(datetimeFormatter) { datetimeFormatter.formatDateTime('2011-12-13T14:15:16+0000'); datetimeFormatter.formatDate('2011-12-13'); datetimeFormatter.formatTime('14:15:16'); }); Twig: {{ '2011-12-13 14:15:16'|oro_format_datetime }} {{ '2011-12-13'|oro_format_date }} {{ '14:15:16'|oro_format_time }} https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/da tetime.js Result: Dec 13, 2011 4:15 PM Dec 13, 2011 2:15 PM
  • 18. Data Localization and Translation Datetime format handling - Different libraries use different datetime formats - Oro Platform provides format converters for libicu, moment.js and jquery.ui - New formatters can be registered using DI tag oro_locale.format_converter.date_time
  • 19. Data Localization and Translation Datetime timezone handling - To simplify timezone handling all DateTime object in the backend should be in UTC timezone - DateTime objects saved to the DB and extracted from the DB are automatically converted to UTC timezone - Formatting of DateTime objects should be performed using DateTimeConverter via service oro_locale.formatter.date_time
  • 20. Data Localization and Translation Number formatting - Numbers are formatted based on locale - Formatter works with decimal, percent, currency, spellout, duration and ordinal values - Number format configuration extracted from libicu via PHP INTL extension - Currency use symbols from YAML files Resources/config/oro/currency_data.yml
  • 21. Data Localization and Translation Number formatting $formatter = $this->get('oro_locale.formatter.number'); $formatter->formatDecimal(12345.6789); $formatter->formatDecimal(12345); $formatter->formatPercent(1.2345); $formatter->formatCurrency(12345.6789); $formatter->formatCurrency(12345.6789, 'EUR'); PHP: Twig: {{ 12345.6789|oro_format_decimal }} {{ 12345|oro_format_decimal }} {{ 1.2345|oro_format_percent }} {{ 12345.6789|oro_format_currency }} {{ 12345.6789|oro_format_currency({'currency':'EUR'}) }} https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Formatter/NumberFormatter.php
  • 22. Data Localization and Translation Number formatting require(['orolocale/js/formatter/number'], function(numberFormatter) { numberFormatter.formatDecimal(12345.6789); numberFormatter.formatInteger(12345); numberFormatter.formatPercent(1.2345); numberFormatter.formatCurrency(12345.6789); numberFormatter.formatCurrency(12345.6789, 'EUR'); }); JS: Result: 12,345.679 12,345 123.45% $12,345.68 €12,345.68 https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/LocaleBundle/Resources/public/js/formatter/nu mber.js
  • 23. Data Localization and Translation Localization CLI commands oro:localization:dump - dump localization configuration from YAML files to web/js/oro.locale_data.js
  • 24. Data Localization and Translation Translation is the communication of the meaning of a source-language text by means of an equivalent target-language text. What is translation?
  • 25. Data Localization and Translation Oro Platform use standard Symfony2 mechanism to perform frontend translation in PHP, in Twig templates, and translator.js library from BazingaJsTranslationBundle Translations are stored in YAML files in any bundle and in the application database. How translations used in Oro Platform?
  • 26. Data Localization and Translation - messages - common messages used both for system and custom purposes - validators - validation messages - jsmessages - messages translated on frontend side - tooltips - messages for and form field tooltips - entity - data for entities translated with Gedmo translatable extension Translation domains
  • 27. Data Localization and Translation Recommended translation message format <application>.<bundle>.<section>.<key> oro.user.form.choose_gender oro.dataaudit.change_history.title oro.entity_config.menu.entities_list.label Format: Examples:
  • 28. Data Localization and Translation Translation extractors - PhpCodeExtractor - extracts formatted strings from PHP code - NavigationTranslationExtractor - extracts title translations from navigation.yml files https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Extractor/PhpCodeEx tractor.php https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/NavigationBundle/Title/TranslationExtrac tor.php
  • 29. Data Localization and Translation Translation on backend $this->get('translator')->trans('oro.dashboard.title.main'); $this->get('translator')->trans('oro.entity.item', ['%id%' => 42]); PHP: Twig: {{ 'oro.dashboard.title.main'|trans }} {{ 'oro.entity.item'|trans({'%id%': 42}) }} Result: Dashboard Item #42 # messages.en.yml oro.dashboard.title.main: "Dashboard" oro.entity.item: "Item #%id%" YAML:
  • 30. Data Localization and Translation Translation on frontend require(['orotranslation/js/translator'], function(__) { __('oro.note.add_note_title'); __('oro.datagrid.pagination.totalRecords', {totalRecords: 42}); }); JS: Result: Add note Total of 42 records # jsmessages.en.yml oro.note.add_note_title: "Add note" oro.datagrid.pagination: totalRecords: "Total of {{ totalRecords }} records" YAML:
  • 31. Data Localization and Translation Translation in the database - table oro_translation - entity OroTranslationBundle:Translation - scopes SYSTEM and UI # id # key # value # locale # domain # scope Translation
  • 32. Data Localization and Translation Translation in database - OrmTranslationLoader - loads translations from database - DatabasePersister - persists translations to database https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Translation/Or mTranslationLoader.php https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Translation/Da tabasePersister.php
  • 33. Data Localization and Translation Translation configuration System > Configuration > Language settings
  • 34. Data Localization and Translation Interaction with Crowdin - Dump translations from translation extractors and YAML files - Download translations from Crowdin - Merge them with existing translations - Upload updated translations to Crowdin Oro Platform Crowdin 1. dump 2. download 3. merge 4. upload
  • 35. Data Localization and Translation Debug translator - Wraps translated strings in square brackets - [<string>] - Wraps not translated strings into exclamation marks - !!!---string---!!! - Add JS prefix for frontend translations - can be enabled in app/config/config.yml oro_translation: debug_translator: true https://github.com/orocrm/platform/blob/1.6.0/src/Oro/Bundle/TranslationBundle/Translation/De bugTranslator.php
  • 36. Data Localization and Translation Debug translator
  • 37. Data Localization and Translation Translation CLI commands oro:translation:dump - dumps frontend translations into web/js/translation/<locale>.js oro:translation:pack - extracts translation files for each bundle in specified vendor namespace and creates language pack
  • 38. Data Localization and Translation Questions and Answers