Skip to content

Commit

Permalink
Merge pull request #11 from weni-ai/rs-296-crowdin-implementation
Browse files Browse the repository at this point in the history
[RS-296] Crowdin Implementation
  • Loading branch information
cristiantela authored Oct 17, 2024
2 parents 3f08eef + 18d5cb2 commit a8db035
Show file tree
Hide file tree
Showing 8 changed files with 345 additions and 350 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/crowdin-download.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Crowdin Download
on:
schedule:
- cron: '0 20 * * *' # Run the workflow every day at 20:00 UTC
permissions:
contents: write
pull-requests: write
jobs:
crowdin-download:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Synchronize with Crowdin
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: true
localization_branch_name: crowdin_translations
create_pull_request: true
pull_request_title: "[CROWDIN] - New translations"
pull_request_body: New Crowdin pull request with translations
pull_request_base_branch_name: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/crowdin-upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Crowdin Upload

on:
push:
paths: [ 'src/locales/**' ]
branches: [ main ]

jobs:
crowdin-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Crowdin push
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: true
download_translations: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
13 changes: 13 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path": "."
"base_url": "https://api.crowdin.com"

"preserve_hierarchy": true

files: [
{
"source": "src/locales/en-US.json",
"translation": "src/locales/%locale%.json",
}
]
91 changes: 91 additions & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"common": {
"cancel": "Cancel",
"continue": "Continue",
"finish_and_save": "Finish and save",
"confirm": "Confirm",
"save": "Save",
"back": "Back",
"errors": {
"unauthorized": "You don't have permission to perform this action",
"internal_server_error": "Internal server error",
"unexpected_error": "An unexpected error has occurred"
}
},
"title": "Weni Commerce",
"description": "Simplify the management of your business, maximize your sales and improve the customer experience with integrated tools.",
"discovery": {
"title": "Discovery"
},
"integrated_solutions": {
"title": "Configured solutions"
},
"active_notifications": {
"title": "Active notifications"
},
"passive_service": {
"title": "Passive service"
},
"solutions": {
"states": {
"empty": {
"title": "No results found",
"description": "Try another keyword or check the spelling"
}
},
"actions": {
"see_details": "See details",
"settings": "Settings",
"disable_solution": "Disable solution"
},
"disable": {
"confirmation": {
"title": "Disable “{name}”",
"description": {
"container": "{0} If deactivated, this tool will no longer work in your project.",
"0": "Do you want to deactivate the “{name}” solution?"
}
}
},
"details": {
"view_settings": "View settings"
},
"integrate": {
"help": {
"container": "{0} If you have any questions about how to fill in the fields below, please consult the {1}.",
"0": "Need help?",
"1": "integration documentation"
},
"button_label": "Integrate resource",
"status": {
"created": "Solution successfully configured",
"removed": "Solution successfully disabled"
}
},
"abandoned_cart": {
"title": "Abandoned cart",
"description": "Recover sales by reminding customers of items forgotten in the cart.",
"tip": "With this solution, you can increase your chances of conversion by keeping your customer close and encouraging them to complete their order."
},
"order_status": {
"title": "Order status",
"description": "Inform your customers about the progress of their orders in real time.",
"tip": "With this solution, it is possible to improve communication with the customer and reduce uncertainty about the purchasing process, increasing satisfaction and loyalty over time."
},
"recurring_purchase": {
"title": "Recurring purchase",
"description": "Facilitate the automatic purchase of products with a subscription solution.",
"tip": "With this solution, you can increase customer retention and generate recurring sales, providing an effortless shopping experience for the consumer."
},
"order_status_passive": {
"title": "Order status (Passive)",
"description": "Offer customers a practical way to check the status of their order.",
"tip": "With this solution, you reduce the volume of manual queries and improve transparency, allowing the customer to always feel informed and in control of the purchasing process."
},
"refer_and_win": {
"title": "Refer and win",
"description": "Encourage customers to recommend your store to friends and family with a rewards program.",
"tip": "With this solution, you can expand your customer base organically and increase engagement, turning satisfied consumers into active promoters of your brand."
}
}
}
91 changes: 91 additions & 0 deletions src/locales/es-ES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"common": {
"cancel": "Cancelar",
"continue": "Continuar",
"finish_and_save": "Finalizar y guardar",
"confirm": "Confirmar",
"save": "Guardar",
"back": "Volver",
"errors": {
"unauthorized": "No tiene permiso para realizar esta acción",
"internal_server_error": "Error interno del servidor",
"unexpected_error": "Se ha producido un error inesperado"
}
},
"title": "Weni Commerce",
"description": "Simplifique la gestión de su negocio, maximice sus ventas y mejore la experiencia del cliente con herramientas integradas.",
"discovery": {
"title": "Descubrimiento"
},
"integrated_solutions": {
"title": "Soluciones configuradas"
},
"active_notifications": {
"title": "Notificaciones activas"
},
"passive_service": {
"title": "Servicio pasivo"
},
"solutions": {
"states": {
"empty": {
"title": "No se han encontrado resultados",
"description": "Pruebe con otra palabra clave o revise la ortografía"
}
},
"actions": {
"see_details": "Ver detalles",
"settings": "Ajustes",
"disable_solution": "Desactivar solución"
},
"disable": {
"confirmation": {
"title": "Desactivar “{name}”",
"description": {
"container": "{0} Si la desactiva, esta herramienta dejará de funcionar en su proyecto.",
"0": "¿Desea desactivar la solución “{name}”?"
}
}
},
"details": {
"view_settings": "Ver configuración"
},
"integrate": {
"help": {
"container": "{0} Si tiene alguna duda sobre cómo rellenar los campos que aparecen a continuación, consulte la {1}.",
"0": "¿Necesita ayuda?",
"1": "documentación sobre la integración"
},
"button_label": "Integrar recurso",
"status": {
"created": "Solución configurada correctamente",
"removed": "Solución desactivada correctamente"
}
},
"abandoned_cart": {
"title": "Carrito abandonado",
"description": "Recuperar ventas recordando a los clientes los artículos olvidados en el carrito.",
"tip": "Con esta solución, puede aumentar sus posibilidades de conversión manteniendo a su cliente cerca y animándole a completar su pedido."
},
"order_status": {
"title": "Estado del pedido",
"description": "Informe a sus clientes sobre el progreso de sus pedidos en tiempo real.",
"tip": "Con esta solución, es posible mejorar la comunicación con el cliente y reducir la incertidumbre sobre el proceso de compra, aumentando la satisfacción y la fidelidad a lo largo del tiempo."
},
"recurring_purchase": {
"title": "Compra periódica",
"description": "Facilite la compra automática de productos con una solución de suscripción.",
"tip": "Con esta solución, puede aumentar la retención de clientes y generar ventas recurrentes, proporcionando una experiencia de compra sin esfuerzo para el consumidor."
},
"order_status_passive": {
"title": "Estado del pedido (Pasivo)",
"description": "Ofrezca a los clientes una forma práctica de comprobar el estado de su pedido.",
"tip": "Con esta solución, se reduce el volumen de consultas manuales y se mejora la transparencia, lo que permite al cliente sentirse siempre informado y en control del proceso de compra."
},
"refer_and_win": {
"title": "Recomiéndanos y gana",
"description": "Anime a los clientes a recomendar su tienda a amigos y familiares con un programa de recompensas.",
"tip": "Con esta solución, puede ampliar su base de clientes de forma orgánica y aumentar el compromiso, convirtiendo a los consumidores satisfechos en promotores activos de su marca."
}
}
}
43 changes: 8 additions & 35 deletions src/locales/index.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,15 @@
import { createI18n } from 'vue-i18n';
import { flattenDeep } from 'lodash';

import messages from './messages.json';

const languages = ['pt-br', 'en-us', 'es'];

function transformMessages(b, prefix = []) {
if (typeof b === 'string') {
return { [prefix.join('.')]: b };
}

return Object.entries(b).map(([key, value]) =>
transformMessages(value, prefix.concat(key)),
);
}

const allMessages = flattenDeep(transformMessages(messages)).reduce(
(previous, current) => ({
...previous,
...current,
}),
{},
);
import enUS from './en-US.json';
import ptBR from './pt-BR.json';
import esES from './es-ES.json';

export const i18n = createI18n({
locale: 'en-us',
fallbackLocale: 'en-us',
messages: Object.fromEntries(
languages.map((language) => [
language,
Object.fromEntries(
Object.keys(allMessages)
.filter((key) => key.endsWith(`.${language}`))
.map((current) => [
current.slice(0, -`.${language}`.length),
allMessages[current],
]),
),
]),
),
messages: {
'en-us': enUS,
'pt-br': ptBR,
es: esES,
},
});
Loading

0 comments on commit a8db035

Please sign in to comment.