Top
Top
LibraryEASYCommerce Reference ManualLanguage
Language Overview
Dictionary
Language Patterns
Adding and Removing Languages

Language Overview

K-Rise offers users the ability to change the language for a site without requiring multiple sites for different regions. This is done with a Google API to translate the text on the page to the desired language.

How it Works

The translation only occurs the first time using the Google API. All the translations returned from the API are then stored in our K-Rise Dictionary. This will make all subsequent loads of the page faster because it will pull from the dictionary instead of again calling the Google API.

Sometimes translations using the google API may not be entirely correct. This can be easily resolved by editing the incorrect translations in the K-Rise dictionary through the admin panel. The next time the page loads, it will first look in the K-Rise dictionary and since it has been translated before, it will find the edited dictionary entry and replace the text/phrase with the admin entered translation.

There are some phrases which will change slightly when they contain numbers. Since each instance of the phrase will have a slightly different number, it will be treated as a different phrase. This means, every time a variation of it appears on the page, it will be translated using the Google API again. Aside from making the page load slow, it would make it impossible to override the google translation with an admin entered translation since it would often be using the google API first.

In order to avoid this, we can save certain “Patterns” which use a variable to mark the numeric value which will differ. So instead of “X items in cart” having hundreds of translations for all the most used numeric values, we could save “{0} items in cart” and it would treat all phrases with numeric value variations as the same phrase.

When the page loads each phrase/text on the page is processes in this order:

  1. Does this text match an existing language pattern?
  2. If a language pattern was found, does the pattern match an existing dictionary entry? If a language pattern was not found, does the text on the page match an existing dictionary entry?
  3. Run the google API to receive a translation and save the result in the K-Rise dictionary for future use.

Changing the language

It is possible to change the language of the site from the header menu. In the top right there is a drop down with flags of different countries. Each flag represents a different language that the site can be translated to.

The base languages that the site supports are English, Spanish, French, Italian, Dutch, Portuguese, Russian, Chinese (simplified), and Chinese (traditional).


Dictionary

Each time the Google translation API is run, the results are saved into the K-Rise dictionary. This makes the next page load faster because the API is only run for phrases/text that do not have a matching entry in the dictionary.

Dictionary Entries can be viewed in the “Work with Translation” admin page. From here entries can be added, deleted, viewed, searched, downloaded and edited.

The dictionary also allows us to provide Admin overrides for certain phrases. Sometimes after a page has been translated, the individual words are translated successfully, but together, they form a phrase which has a better suited translation that is not shown. This can be fixed by editing the dictionary entry. The next time the page loads we will match the text on the page with a dictionary entry and use the new admin entered translation.

View, Edit, and Delete Dictionary Entries

The “Work with Translation” admin page allows the admin to view all the dictionary entries. Since so many entries can exist, the user must first select a language from the drop down menu for the list section to populate.

Once the list section is populated, the admin can view, edit, and delete existing dictionary entries.

Each line in the list section of dictionary entries has a “Change” link. This is where the admin overrides are entered. Since the Google API is only run the first time, the text will have a saved dictionary entry which will be used for all subsequent translations. If the translation returned from the API is not correct, or you wish to change the translation, the entries can be edited and everywhere the text is shown, it will be replaced with your entered translation for the selected language.

Dictionary Entries can be deleted from the list section with the “Delete” button on each line of the list section. Deleting an entry will delete it from the database where the dictionary is stored. This means, when the page loads next, if the text is found on the page again, since there is no dictionary entry found, the Google API will run and a new entry will be saved for the resulting translation.

Downloading Translations

After a list section is showing the desired results (by selecting the appropriate language and applying search filters), the list can be downloaded by clicking the download icon in the top left corner of the list section.

The downloaded spreadsheet will have the three required columns of a translation: Language, Text, and Translated Text.

Add New Dictionary Entries

When configuring a site for a new language, admin users can upload a batch of dictionary entries at once using either the “Quick Add” or the “Excel Upload” feature. Both of these features require 3 pieces of information: the text to be translated (Text), the translation (Translated Text), and the language (Language).

Quick Add

The “Quick Add” feature allows many to be input at once via the UI.

Excel Upload

The excel upload feature requires that the 3 pieces of information be given in an excel. This allows for large numbers of dictionary entries to be entered at once. The template for the upload can be obtained by downloading a translation list. This will create a spreadsheet with the 3 required columns.


Language Patterns

Sometimes very similar text will display on the page, but will change slightly in a predictable way. This often happens when a phrase contains a numeric value. Since each instance of the phrase will have a slightly different number, it will be treated as a different phrase. This means, every time a variation of it appears on the page, it will be translated using the Google API again. Aside from making the page load slow, it would make it impossible to override the google translation with an admin entered translation since it would often be using the google API first.

In order to avoid this, we can save certain “Patterns” which use a variable to mark the numeric value which will differ. So instead of “X items in cart” having hundreds of translations for all the most used numeric values, we could save “{0} items in cart” and it would treat all phrases with numeric value variations as the same phrase. As a result, one translation will tell us how to translate all different variations of the pattern.

On the “Work with Language Patterns” page, you can view the existing language patterns and mark them as inactive/active or delete them. You can also add a new pattern to be shown in the list.

An example of a Language Pattern is the text at the bottom of a list section used to page through the results: “Total records found: 10. Displaying record 1 to 10”. Since the numeric values of this phrase will change based on the number of results returned and the page the user is on, there can be many variations of this phrase. If it were not entered as a Language Pattern, the Google API would run each time a new variation appeared on the page. As a result, the dictionary would contain many results like below:

If one variation of this phrase were translated, it would be the same for every number of page we are on or any number of results found. That pattern would be listed as: “Total records found: {0}. Displaying record {0} to {0}.”


Adding and Removing Languages

[Navigate to Work With Languages]

The Language Code Lookup is a link to https://cloud.google.com/translate/docs/languages the google translate api documentation. Here all supported language codes will be listed. Enter the Code the name and upload a png image when ready click add then this new language will be ready to be used. The image must have a file name of [Language Code].png. It must be a Png.

A list section will display all the existing languages. This will allow you to mark languages as inactive so they will not show in the drop down list available to users. You could also delete languages altogether by clicking the “Delete” button on the line for the language you wish to delete.


Powered by EASYProcess (© 2019 K-Rise Systems, Inc).