Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/demo-app-video/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

i18n
.use(I18nextBrowserLanguageDetector)
Expand All @@ -21,6 +22,7 @@ i18n
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
})
.catch(console.error);
Expand Down
5 changes: 5 additions & 0 deletions apps/demo-app-video/src/translations/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"inspection-complete": {
"thank-message": "Grazie per aver dedicato del tempo a completare l'ispezione."
}
}
2 changes: 2 additions & 0 deletions apps/demo-app/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

i18n
.use(I18nextBrowserLanguageDetector)
Expand All @@ -21,6 +22,7 @@ i18n
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
})
.catch(console.error);
Expand Down
1 change: 1 addition & 0 deletions apps/demo-app/src/translations/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions packages/camera-web/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

/**
* i18n instance of the Camera package. You can use this instance to automatically sync your application current
Expand All @@ -14,5 +15,6 @@ export const i18nCamera = i18nCreateSDKInstance({
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});
3 changes: 3 additions & 0 deletions packages/camera-web/src/translations/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"retry": "Riprova"
}
6 changes: 6 additions & 0 deletions packages/camera-web/src/utils/errors.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,47 @@ export function getCameraErrorLabel(error?: UserMediaErrorType): TranslationObje
fr: "L'apperçu de la caméra n'est pas disponible car l'accès à la caméra n'est pas autorisé.",
de: 'Die Kameravorschau ist nicht verfügbar, da für die Seite kein Kamerazugriff gewährt wurde.',
nl: 'De cameravoorbeeld is niet beschikbaar omdat er geen toegang tot de camera is verleend aan de pagina.',
it: "L'anteprima della fotocamera non è disponibile perché l'accesso alla fotocamera non è stato concesso alla pagina.",
};
case UserMediaErrorType.WEBPAGE_NOT_ALLOWED:
return {
en: 'Unable to get camera access. Make sure to press “Allow” when asked to grant camera permission for this web page.',
fr: "Impossible d'accéder à la caméra. Veuillez vous assurer d'appuyer sur “Autoriser” lorsqu'on vous propose d'autoriser l'accès à la caméra pour cette page web.",
de: 'Die Kamera kann nicht zugelassen werden. Stellen Sie sicher, dass Sie auf „Zulassen“ drücken, wenn Sie aufgefordert werden, die Kamera für diese Webseite zuzulassen.',
nl: 'Kan geen toestemming krijgen voor de camera. Zorg ervoor dat u op “Toestaan” drukt wanneer u wordt gevraagd om toestemming te geven voor het gebruik van de camera op deze webpagina.',
it: 'Impossibile ottenere l\'accesso alla fotocamera. Assicurati di premere "Consenti" quando ti viene chiesto di concedere il permesso di utilizzare la fotocamera per questa pagina web.',
};
case UserMediaErrorType.BROWSER_NOT_ALLOWED:
return {
en: "Unable to get camera access. Make sure to grant camera access to your current internet browser in your device's settings.",
fr: "Impossible d'accéder à la caméra. Veuillez vous assurer d'autoriser l'accès à la caméra pour ce navigateur internet dans les paramètres de votre téléphone.",
de: 'Der Zugriff auf die Kamera ist nicht möglich. Stellen Sie sicher, dass Sie in den Einstellungen Ihres Geräts den Kamerazugriff für Ihren aktuellen Internetbrowser zulassen.',
nl: 'Kan geen cameratoegang krijgen. Zorg ervoor dat u de camera toegang verleent tot uw huidige internet browser in de instellingen van uw apparaat.',
it: "Impossibile ottenere l'accesso alla fotocamera. Assicurati di concedere l'accesso alla fotocamera al tuo browser internet corrente nelle impostazioni del tuo dispositivo.",
};
case UserMediaErrorType.STREAM_INACTIVE:
return {
en: 'The camera video stream was closed unexpectedly.',
fr: 'Le flux vidéo de la caméra a été coupé de manière inattendue.',
de: 'Der Video-Stream der Kamera wurde unerwartet geschlossen.',
nl: 'De videostream van de camera is onverwacht gesloten.',
it: 'Il flusso video della fotocamera è stato chiuso inaspettatamente.',
};
case UserMediaErrorType.INVALID_STREAM:
return {
en: 'Unable to process the camera video stream.',
fr: 'Impossible de traiter le flux vidéo de la caméra.',
de: 'Der Videostrom der Kamera kann nicht verarbeitet werden.',
nl: 'De videostream van de camera kan niet worden verwerkt.',
it: 'Impossibile elaborare il flusso video della fotocamera.',
};
default:
return {
en: 'An unexpected error occurred when fetching the camera video stream.',
fr: 'Une erreur inattendue est survenue lors de la récupération du flux vidéo de la caméra.',
de: 'Beim Abrufen des Kamera-Videostreams ist ein unerwarteter Fehler aufgetreten.',
nl: 'Er is een onverwachte fout opgetreden bij het ophalen van de videostream van de camera.',
it: 'Si è verificato un errore imprevisto durante il recupero del flusso video della fotocamera.',
};
}
}
3 changes: 3 additions & 0 deletions packages/camera-web/test/utils/errors.utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('Camera error utils', () => {
fr: expect.any(String),
de: expect.any(String),
nl: expect.any(String),
it: expect.any(String),
});
});
});
Expand All @@ -19,6 +20,7 @@ describe('Camera error utils', () => {
fr: expect.any(String),
de: expect.any(String),
nl: expect.any(String),
it: expect.any(String),
});
});

Expand All @@ -28,6 +30,7 @@ describe('Camera error utils', () => {
fr: expect.any(String),
de: expect.any(String),
nl: expect.any(String),
it: expect.any(String),
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

/**
* i18n instance of the CaptureSelection component. You can use this instance to automatically sync your application
Expand All @@ -14,6 +15,7 @@ const i18nCreateInspection = i18nCreateSDKInstance({
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"addDamage": {
"title": "Segnala un danno",
"description": "Aggiungi foto di ammaccature, graffi o altri danni presenti sul veicolo.",
"button": "Aggiungi foto dei danni"
},
"capture": {
"title": "Avvia l’ispezione",
"description": "Nessuna ammaccatura o graffio? Fai il giro del veicolo e scatta delle foto.",
"button": "Scatta foto"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

/**
* i18n instance of the CreateInspection component. You can use this instance to automatically sync your application
Expand All @@ -14,6 +15,7 @@ const i18nCreateInspection = i18nCreateSDKInstance({
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"errors": {
"retry": "Riprova",
"create-inspection": "Si è verificato un errore imprevisto durante la creazione dell'ispezione.",
"missing-inspection-id": "L'URL a cui stai tentando di accedere non è valido."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

/**
* i18n instance of the Inspection CApture Web package. You can use this instance to automatically sync your application
Expand All @@ -14,6 +15,7 @@ const i18nImageDetailedView = i18nCreateSDKInstance({
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"retake": "Ripeti"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

const i18nInspectionGallery = i18nCreateSDKInstance({
resources: {
en: { translation: en },
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"card": {
"addDamage": "Aggiungi un danno"
},
"topBar": {
"submit": "Conferma",
"title": "Foto",
"retakeFilter": "Riprese",
"approvedFilter": "Scattate e approvate",
"completed": "Questa ispezione è terminata"
},
"list": {
"empty": {
"capture": "Nessuna foto. Le foto scattate appariranno qui.",
"nonCapture": "Non ci sono foto in questa ispezione.",
"filter": "Nessun risultato per il filtro selezionato."
}
}
}
2 changes: 2 additions & 0 deletions packages/common-ui-web/src/components/Login/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

/**
* i18n instance of the Login component. You can use this instance to automatically sync your application current
Expand All @@ -14,6 +15,7 @@ const i18nLogin = i18nCreateSDKInstance({
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});

Expand Down
10 changes: 10 additions & 0 deletions packages/common-ui-web/src/components/Login/translations/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"actions": { "log-in": "Accedi", "log-out": "Disconnetti" },
"errors": {
"popup-closed": "Ops! Non siamo riusciti a collegarti perché il pop-up è stato chiuso. Proviamo di nuovo!",
"token-expired": "Il tuo token di autenticazione è scaduto. Effettua nuovamente l'accesso.",
"insufficient-authorization": "Non hai le autorizzazioni necessarie per utilizzare questa applicazione. Disconnettiti e usa un altro account.",
"unknown": "Ops! Si è verificato un errore imprevisto durante la connessione. Proviamo di nuovo!",
"missing-token": "L'URL a cui stai tentando di accedere non è valido."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

const i18nVehicleTypeSelection = i18nCreateSDKInstance({
resources: {
en: { translation: en },
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"header": {
"title": "Seleziona il tipo di veicolo",
"confirm": "Conferma"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('ImageDetailedViewOverlay component', () => {

it('should display the image label with the proper icon', () => {
const props = createProps();
props.image.label = { en: 'test', fr: 'fr', de: 'test-de', nl: 'test-nl' };
props.image.label = { en: 'test', fr: 'fr', de: 'test-de', nl: 'test-nl', it: 'test-it' };
const icon = 'hello-test-icon';
const primaryColor = 'test-primary-test';
(useImageLabelIcon as jest.Mock).mockImplementationOnce(() => ({ icon, primaryColor }));
Expand Down
16 changes: 15 additions & 1 deletion packages/common/README/INTERNATIONALIZATION.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Internationalization

This README page is aimed at providing documentation on a specific part of the `@monkvision/common` package : the
internationalization. You can refer to [this page](README.md) for more general information on the package.

This package exports utility functions and hooks tools that help you manage the internationalization support of the Monk
SDK, as well as common translations that can be useful when interacting with the SDK.

# react-i18next

The internationalization in the Monk SDK (and in Monk Webapps) is handled using [i18n](https://www.i18next.com/) and
[react-i18next](https://react.i18next.com/). This means that installing some of our packages (like
`@monkvision/inspection-report-web` for instance) will mean automatically adding these packages as dependencies in your
Expand All @@ -24,8 +26,11 @@ specify to it which language you want it to use. The following languages are sup
- Dutch

# i18n Utilities

## i18nWrap wrapper

### Description

This wrapped is used by internal monk SDK to wrap the component with I18nextProvider.

### Example of usage
Expand All @@ -43,19 +48,23 @@ import en from './translations/en.json';
import fr from './translations/fr.json';
import de from './translations/de.json';
import nl from './translations/nl.json';
import it from './translations/it.json';

const i18nMyComponent = i18nCreateSDKInstance({
resources: {
en: { translation: en },
fr: { translation: fr },
de: { translation: de },
nl: { translation: nl },
it: { translation: it },
}
})
```

## useI18nSync hook

### Description

This hook is used mostly by MonkJs packages internally to synchronize their own i18n instance with the language param
or prop that they are provided.

Expand All @@ -76,17 +85,21 @@ function MyComponent(props: MyComponentProps) {
```

## getLanguage

```ts
import i18n from 'i18next';
import { getLanguage } from '@monkvision/common';

console.log(getLanguage(i18n.language));
```

This function retrieves the language prefix from a given language string.
If the prefix is not found in the list of supported languages (monkLanguages in Types package), it returns 'en' as default.

# Common Translations

## Car Parts

You can import the car parts translations like this :

```typescript
Expand All @@ -97,6 +110,7 @@ The `cartPartLabels` object maps each `VehiclePart` name (enum from `@monkvision
containing a label for each supported language.

## Image Status Labels

You can import the image status labels translations like this :

```typescript
Expand All @@ -106,8 +120,8 @@ import { imageStatusLabels } from '@monkvision/common';
The `imageStatusLabels` object maps each `ImageStatus` (enum from `@monkvision/types`) to an object containing a `title`
and a `description` property, both of which are TranslationObject`s containing a label for each supported language.


## Compliance Issue Labels

You can import the compliance issue labels translations like this :

```typescript
Expand Down
Loading