ride/web-i18n-expose

Ride module to expose the i18n translator to javascript

1.1.1 2018-03-28 09:55 UTC

This package is auto-updated.

Last update: 2024-12-13 00:01:49 UTC


README

Ride module to expose the i18n translator to javascript.

How It Works?

When this module is installed, the translator.js will be added to your HTML views. This will make the Ride translator object available in Javascript. You can request translations from it through the translate method. Once all your translations are requested, you will have to submit the keys through the submitTranslationKeys. Those keys will be included in the view from then on in the following requests.

Code Sample

You can translate a string in javascript with the following function:

rideApp.translator.translate('button.save');
rideApp.translator.translate('success.data.saved', {data: "Sme"});

Once all translations are requested, you need to submit these keys to make them available in the following requests:

rideApp.translator.submitTranslationKeys();

Related Modules

Installation

You can use Composer to install this application.

composer require ride/web-i18n-expose