Installazione contestuale


Crowdin In-Context works with the help of a one-line Javascript snippet and pseudo-language package. It creates a pseudo-language package based on the localization files uploaded to your project, which later will be integrated into your application as an extra localization language.

La pseudo-lingua integrata contiene alcuni identificatori speciali invece dei testi originali, di conseguenza quando modifica la lingua della tua app a questa, tutte le etichette sono convertite ad identificatori speciali. Javascript searches for those identifiers and replaces them with editable labels. So, the In-context page of your web app will look the same as your application, with the only difference that translatable strings will be editable.

Vista In-Context

Translations are made directly in the app, with no need to open the Editor. As a simplified version of Crowdin Editor will be displayed, with all the functionality (TM, machine translation, approve/vote option, comments, terms) provided. Thus, it’s easier to make and review translations, as that can be previewed in a real context.

Editor di In-Context


There are two common approaches to integrate Crowdin In-Context with your application:

  • Staging or translation environment. If you are not planning to invite your end-users to help with translations or not considering to use a “translation mode” in your production application, integrating Crowdin In-Context to your staging or dedicated translation app environment would be a good solution.
  • Production environment. Crowdin In-Context non richiede alcune modifiche al codice nella tua applicazione, così che possa essere usato anche per la produzione. You decide how to turn it on and which segment of users will use it. The most common use cases are the following:
    • you can create a mirror website, that is a complete copy of your application, but under a different URL (for example, instead of it can be, where translators will make translations like if it was your real application.
    • you can also add In-context as an extra language. So, when translators open your application they will be able to choose one extra language from the list, which will open In-context for them.

Follow the integration setup guide in your Crowdin project to set up In-context. The guide can be found in the left-hand panel in your project, under Resources > Integrations & API.

Scheda di In-Context

After the integration is successfully set up and you refreshed your application, you should be able to see the invitation dialog and Crowdin login box.

Finestra d'Accesso

Parametri Opzionali

Puoi aggiungere questi parametri all’insieme _jipt nello snippet di configurazione.

Precaricamento dei Testi

_jipt.push(['preload_texts', true]);

Speeds up dynamic content displaying within the In-Context tool by preloading all source strings. Automatically disabled for the large projects (5000+ strings). Acceptable values: true, false.

Pulsante di Traduzione Sempre Visibile

_jipt.push(['touch_optimized', true]);

This option is enabled on touchscreens by default and makes the translation button next to each translatable string permanently visible, as opposed to showing on hover. Acceptable values: true, false.

Prima della Richiamata di Conferma

_jipt.push(['before_commit', function(source, translation, context, language_code) { return status_obj; }]);

Funzione per convalidare il suggerimento prima di inviare.

fonteTesto di origine
traduzioneTesto di traduzione
contestoContesto della stringa di origine
language_codeCodice lingua di destinazione (codici lingua)
Restituisci Valori
status_obj Oggetto. Lo status_obj.status può essere "ok", "errore" o "corretto". In caso di errore, status_obj.message contiene la descrizione dell'errore. Quando lo status è "corretto", status_obj.correction contiene la traduzione corretta

Prima della Richiamata di Inserimento DOM

_jipt.push(['before_dom_insert', function(text, node, attribute) { return 'text'; }]);

Funzione per trasformare la stringa prima che sia inserita nel DOM.

testoStringa per l'inserimento
DOM element in which the text must be inserted. May be omitted if the text does not have a target element (text inside the browser's pop-ups)
The attribute of DOM element, if the text is part of an attribute
Restituisci Valori
testoStringa per l'inserimento
falseSe la funzione restituisce false, DOM non sarà aggiornato

Chiudi la Richiamata di Sovrapposizione In-Context

_jipt.push(['escape', function() { window.location.href = ""; }]);

Se definito, gli utenti possono chiudere la sovrapposizione In-Context se non vogliono tradurre. Implementa questa funzione dalla tua parte. It must change the app’s language or redirect from translation environment to the production app, depending on the In-Context integration approach.

Chiudi Finestra d'Accesso

Questo articolo è stato utile?