diff --git a/packages/translations/src/languages/es.ts b/packages/translations/src/languages/es.ts index 41e4df9a7..82cc3bfbd 100644 --- a/packages/translations/src/languages/es.ts +++ b/packages/translations/src/languages/es.ts @@ -94,8 +94,8 @@ export const esTranslations: DefaultTranslationsObject = { invalidFileTypeValue: 'Tipo de archivo inválido: {{value}}', invalidRequestArgs: 'Argumentos no válidos en la solicitud: {{args}}', loadingDocument: 'Ocurrió un problema al cargar el documento con la ID {{id}}.', - localesNotSaved_one: 'No se pudo guardar la siguiente configuración regional:', - localesNotSaved_other: 'No se pudieron guardar las siguientes configuraciones regionales:', + localesNotSaved_one: 'No se pudo guardar el siguiente idioma:', + localesNotSaved_other: 'No se pudieron guardar los siguientes idiomas:', logoutFailed: 'El cierre de sesión falló.', missingEmail: 'Falta el correo.', missingIDOfDocument: 'Falta la ID del documento a actualizar.', @@ -215,7 +215,7 @@ export const esTranslations: DefaultTranslationsObject = { adminTheme: 'Tema del admin', all: 'Todo', allCollections: 'Todas las colecciones', - allLocales: 'Todas las ubicaciones', + allLocales: 'Todos los idiomas', and: 'Y', anotherUser: 'Otro usuario', anotherUserTakenOver: 'Otro usuario ha tomado el control de la edición de este documento.', @@ -287,7 +287,7 @@ export const esTranslations: DefaultTranslationsObject = { error: 'Error', errors: 'Errores', export: 'Exportación', - fallbackToDefaultLocale: 'Volver a la configuración regional por defecto', + fallbackToDefaultLocale: 'Volver al idioma configurado por defecto', false: 'Falso', filter: 'Filtro', filters: 'Filtros', @@ -305,8 +305,8 @@ export const esTranslations: DefaultTranslationsObject = { light: 'Claro', livePreview: 'Previsualizar', loading: 'Cargando', - locale: 'Regional', - locales: 'Locales', + locale: 'Idioma', + locales: 'Idiomas', menu: 'Menú', moreOptions: 'Más opciones', move: 'Mover', @@ -404,13 +404,13 @@ export const esTranslations: DefaultTranslationsObject = { yes: 'Sí', }, localization: { - cannotCopySameLocale: 'No se puede copiar al mismo lugar', + cannotCopySameLocale: 'No se puede copiar al mismo idioma', copyFrom: 'Copiar de', copyFromTo: 'Copiando de {{from}} a {{to}}', copyTo: 'Copia a', - copyToLocale: 'Copiar a localización', - localeToPublish: 'Locación para publicar', - selectLocaleToCopy: 'Seleccione la ubicación para copiar', + copyToLocale: 'Copiar a idioma', + localeToPublish: 'Idioma para publicar', + selectLocaleToCopy: 'Selecciona el idioma a copiar', }, operators: { contains: 'contiene', @@ -522,7 +522,7 @@ export const esTranslations: DefaultTranslationsObject = { previouslyPublished: 'Publicado Anteriormente', problemRestoringVersion: 'Ocurrió un problema al restaurar esta versión', publish: 'Publicar', - publishAllLocales: 'Publicar todas las configuraciones regionales', + publishAllLocales: 'Publicar en todos los idiomas', publishChanges: 'Publicar cambios', published: 'Publicado', publishIn: 'Publicar en {{locale}}', diff --git a/packages/translations/src/languages/nl.ts b/packages/translations/src/languages/nl.ts index 4025cea21..a0b4c8256 100644 --- a/packages/translations/src/languages/nl.ts +++ b/packages/translations/src/languages/nl.ts @@ -214,7 +214,7 @@ export const nlTranslations: DefaultTranslationsObject = { adminTheme: 'Adminthema', all: 'Alle', allCollections: 'Alle collecties', - allLocales: 'Alle locaties', + allLocales: 'Alle talen', and: 'En', anotherUser: 'Een andere gebruiker', anotherUserTakenOver: 'Een andere gebruiker heeft de bewerking van dit document overgenomen.', @@ -305,7 +305,7 @@ export const nlTranslations: DefaultTranslationsObject = { livePreview: 'Voorbeeld', loading: 'Laden', locale: 'Taal', - locales: 'Landinstellingen', + locales: 'Talen', menu: 'Menu', moreOptions: 'Meer opties', move: 'Verplaatsen', @@ -403,13 +403,13 @@ export const nlTranslations: DefaultTranslationsObject = { yes: 'Ja', }, localization: { - cannotCopySameLocale: 'Kan niet naar dezelfde locatie kopiëren', + cannotCopySameLocale: 'Kan niet naar dezelfde taal kopiëren', copyFrom: 'Kopiëren van', copyFromTo: 'Kopiëren van {{from}} naar {{to}}', copyTo: 'Kopiëren naar', - copyToLocale: 'Kopieer naar locatie', - localeToPublish: 'Te publiceren locatie', - selectLocaleToCopy: 'Selecteer locatie om te kopiëren', + copyToLocale: 'Kopieer naar taal', + localeToPublish: 'Te publiceren taal', + selectLocaleToCopy: 'Selecteer taal om te kopiëren', }, operators: { contains: 'bevat', @@ -536,10 +536,10 @@ export const nlTranslations: DefaultTranslationsObject = { saveDraft: 'Bewaar concept', scheduledSuccessfully: 'Succesvol gepland.', schedulePublish: 'Publicatie plannen', - selectLocales: 'Selecteer locales om weer te geven', + selectLocales: 'Selecteer talen om weer te geven', selectVersionToCompare: 'Selecteer een versie om te vergelijken', showingVersionsFor: 'Versies tonen voor:', - showLocales: 'Toon locales:', + showLocales: 'Toon talen:', status: 'Status', unpublish: 'Publicatie ongedaan maken', unpublishing: 'Publicatie ongedaan maken...', diff --git a/tools/scripts/src/generateTranslations/utils/translateText.ts b/tools/scripts/src/generateTranslations/utils/translateText.ts index 712909940..3c124f337 100644 --- a/tools/scripts/src/generateTranslations/utils/translateText.ts +++ b/tools/scripts/src/generateTranslations/utils/translateText.ts @@ -6,15 +6,55 @@ const dirname = path.dirname(filename) dotenv.config({ path: path.resolve(dirname, '../../../../', '.env') }) +type TranslationMessage = { + role: 'system' | 'user' + content: string +} + export async function translateText(text: string, targetLang: string) { + const systemMessage: TranslationMessage = { + role: 'system', + content: `Only respond with the translation of the text you receive. The original language is English and the translation language is ${targetLang}. Use formal and professional language. Only respond with the translation - do not say anything else. + + Respect the meaning of the original text within the context of Payload. Here is a list of common Payload terms that carry very specific meanings: + - Collection: A collection is a group of documents that share a common structure and purpose. Collections are used to organize and manage content in Payload. + - Field: A field is a specific piece of data within a document in a collection. Fields define the structure and type of data that can be stored in a document. + - Document: A document is an individual record within a collection. It contains data structured according to the fields defined in the collection. + - Global: A global is a special type of collection that can only have 1 item and there cannot be multiple globals of the same type. + - Locale: A locale is a specific language or regional setting that can be used to display content in different languages or formats. + - Tenant: A tenant is a sub group in Payload, allowing a single instance of Payload to isolate users, data and content based on specific permissions. + - SEO: SEO stands for Search Engine Optimization, which is the practice of optimizing content to improve its visibility and ranking in search engine results. + - Payload: Payload is the name of the headless CMS platform that this text is related to. + - Import and export: are terms used to describe the process of transferring data into or out of Payload, typically in a structured format like JSON or CSV. + + If a term is capitalized treat it as a proper noun and do not translate it. If a term is not capitalized, translate it normally. For example, do not translate the word "Payload" or "Field" but you can translate "payload" or "field". + + Examples of translations: + + + - Locale: Taal - never locatie + - Collection: Collectie + + + + - Locale: Idioma - never region or ubicación + - Collection: Colección + + + + Apply these translations consistently so that the meaning is preserved across different languages. If you are unsure about a translation, use the examples as a guide. If there is not equivalant term in the target language, use the closes term to it. Use the same term consistently throughout the translation. + + Use formal and professional language, avoiding colloquialisms or informal expressions. The translation should be clear, concise, and suitable for a professional context. + + If you cannot translate the text, respond with "[SKIPPED]". Do not translate text inside double curly braces, i.e. "{{do_not_translate}}". + `, + } + const response = await fetch('https://api.openai.com/v1/chat/completions', { body: JSON.stringify({ max_tokens: 150, messages: [ - { - content: `Only respond with the translation of the text you receive. The original language is English and the translation language is ${targetLang}. Use formal and professional language. Only respond with the translation - do not say anything else. If you cannot translate the text, respond with "[SKIPPED]". Do not translate text inside double curly braces, i.e. "{{do_not_translate}}".`, - role: 'system', - }, + systemMessage, { content: text, role: 'user',