I-Kontekst opsætning

Oversigt

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.

Det integreret pseudosprog indeholder nogle særlige identifikatorer i stedet for de oprindelige tekster, således at når du skifter dit program til det pågældende sprog, konverteres alle etiketterne til de særlige identifikatorer. 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.

In-Context View

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.

In-Context Editor

Integration

Der er to almindelige metoder til integration af Crowdins I-Kontekst i din applikation:

  • Aftestnings- eller oversættelsemiljø. 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.
    • Produktionsmiljø. Crowdins I-Kontekst kræver ikke nogen kodeændringer i dit program, så den kan benyttes selv ved produktion. 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 crowdin.com it can be translate.crowdin.com), 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.

In-Context Tab

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.

Login Window

Valgfrie parametre

Du kan tilføje disse parametre til _jipt-matrixen i opsætningsbiblioteket.

Forudindlæsning af tekster

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

Accelererer dynamisk indholdsvisning i I-Kontekst værktøjet ved at forudindlæse alle kildestrenge. Automatisk deaktiveret for store projekter (>5.000 strenge). Gyldigt input er: true, false.

Oversættelsesknap altid synlig

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

Indstillingen er som standard aktiveret på touch-skærme og gør alle oversættelsesknapperne ved siden af hver oversætbare streng permanent synlige i modsætning visning alene ved mus-over. Gyldigt input er: true, false.

Før Commit Callback

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

Funktion til forslagsvalidering, inden det comittes.

Parametre
sourceKildetekst
translationOversættelsestekst
contextKildestrengskontekst
language_codeMålsprogskode (sprogkoder)
Returværdier
status_obj Objekt. status_obj.status kan være "ok", "fejl" eller "korrigeret". I tilfælde af fejl, indeholder status_obj.message fejlbeskrivelsen. Når status er "korrigeret", indeholder status_obj.korrektion den korrigerede oversættelse

Før DOM Insert Callback

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

Funktion til at transformere strengen, før den indsættes i DOM.

Parametre
textString til indsættelse
node
valgfri
DOM-element, hvori teksten skal indsættes. May be omitted if the text does not have a target element (text inside the browser's pop-ups)
attribut
valgfri
The attribute of DOM element, if the text is part of an attribute
Returværdier
textString til indsættelse
falseReturnerer funktionen false, opdateres DOM ikke

Luk I-Konteksts Overlay Callback

_jipt.push(['escape', function() { window.location.href = "http://app_domain.com"; }]);

Hvis defineret, kan brugerne lukke I-Kontekst overlejringen, hvis de ikke ønsker at oversætte. Implementér denne funktion på din side. It must change the app’s language or redirect from translation environment to the production app, depending on the In-Context integration approach.

Close Login Window

Var denne artikel nyttig?