fix: merge common and web po files (#1563)

This commit is contained in:
David Nguyen
2024-12-31 17:20:58 +11:00
committed by GitHub
parent 0d3681e26a
commit 4085151f80
20 changed files with 8879 additions and 9587 deletions

View File

@ -20,11 +20,7 @@ If you are looking for development notes on translations, you can find them [her
We store our translations in PO files, which are located in our GitHub repository [here](https://github.com/documenso/documenso/tree/main/packages/lib/translations). We store our translations in PO files, which are located in our GitHub repository [here](https://github.com/documenso/documenso/tree/main/packages/lib/translations).
The translation files are organized into folders represented by their respective language codes (`en` for English, `de` for German, etc). Each language folder contains three PO files: The translation files are organized into folders represented by their respective language codes (`en` for English, `de` for German, etc).
1. `web.po`: Translations for the web application
2. `marketing.po`: Translations for the marketing application
3. `common.po`: Shared translations between web and marketing
Each PO file contains translations which look like this: Each PO file contains translations which look like this:
@ -46,11 +42,10 @@ msgstr "Möchten Sie auffällige Signatur-Links wie diesen senden? <0>Überprüf
### Updating Existing Translations ### Updating Existing Translations
1. Fork the repository. 1. Fork the repository.
2. Navigate to the appropriate language folder. 2. Navigate to the appropriate language folder and open the PO file you want to update.
3. Open the PO file you want to update (web.po, marketing.po, or common.po). 3. Make your changes, ensuring you follow the PO file format.
4. Make your changes, ensuring you follow the PO file format. 4. Commit your changes with a message such as `chore: update German translations`
5. Commit your changes with a message such as `chore: update German translations` 5. Create a Pull Request.
6. Create a Pull Request.
### Adding a New Language ### Adding a New Language

View File

@ -1,22 +0,0 @@
import type { LinguiConfig } from '@lingui/conf';
import { APP_I18N_OPTIONS } from '@documenso/lib/constants/i18n';
// Extends root lingui.config.cjs.
const config: LinguiConfig = {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
locales: APP_I18N_OPTIONS.supportedLangs as unknown as string[],
catalogs: [
{
path: '<rootDir>/../../packages/lib/translations/{locale}/web',
include: ['<rootDir>/apps/web/src'],
},
{
path: '<rootDir>/../../packages/lib/translations/{locale}/common',
include: ['<rootDir>/packages/ui', '<rootDir>/packages/lib'],
},
],
catalogsMergePath: '<rootDir>/../../packages/lib/translations/{locale}/web',
};
export default config;

View File

@ -5,14 +5,13 @@
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"dev": "next dev -p 3000", "dev": "next dev -p 3000",
"build": "npm run translate:extract --prefix ../../ && turbo run translate:compile && next build", "build": "npm run translate --prefix ../../ && next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"e2e:prepare": "next build && next start", "e2e:prepare": "next build && next start",
"lint:fix": "next lint --fix", "lint:fix": "next lint --fix",
"clean": "rimraf .next && rimraf node_modules", "clean": "rimraf .next && rimraf node_modules",
"copy:pdfjs": "node ../../scripts/copy-pdfjs.cjs", "copy:pdfjs": "node ../../scripts/copy-pdfjs.cjs"
"translate:compile": "lingui compile --typescript"
}, },
"dependencies": { "dependencies": {
"@documenso/api": "*", "@documenso/api": "*",

View File

@ -9,12 +9,7 @@ const config: LinguiConfig = {
catalogs: [ catalogs: [
{ {
path: '<rootDir>/packages/lib/translations/{locale}/web', path: '<rootDir>/packages/lib/translations/{locale}/web',
include: ['apps/web/src'], include: ['apps/web/src', 'packages/ui', 'packages/lib', 'packages/email'],
exclude: ['**/node_modules/**'],
},
{
path: '<rootDir>/packages/lib/translations/{locale}/common',
include: ['packages/ui', 'packages/lib', 'packages/email'],
exclude: ['**/node_modules/**'], exclude: ['**/node_modules/**'],
}, },
], ],

View File

@ -32,8 +32,9 @@
"trigger:dev": "npm run with:env -- npx trigger-cli dev --handler-path=\"/api/jobs\"", "trigger:dev": "npm run with:env -- npx trigger-cli dev --handler-path=\"/api/jobs\"",
"inngest:dev": "inngest dev -u http://localhost:3000/api/jobs", "inngest:dev": "inngest dev -u http://localhost:3000/api/jobs",
"make:version": " npm version --workspace @documenso/web --include-workspace-root --no-git-tag-version -m \"v%s\"", "make:version": " npm version --workspace @documenso/web --include-workspace-root --no-git-tag-version -m \"v%s\"",
"translate": "npm run translate:extract && npm run translate:compile",
"translate:extract": "lingui extract --clean", "translate:extract": "lingui extract --clean",
"translate:compile": "turbo run translate:compile --filter=@documenso/web --filter=@documenso/ui" "translate:compile": "lingui compile"
}, },
"packageManager": "npm@10.7.0", "packageManager": "npm@10.7.0",
"engines": { "engines": {

View File

@ -21,15 +21,7 @@ export async function loadCatalog(lang: SupportedLanguages): Promise<{
}> { }> {
const extension = process.env.NODE_ENV === 'development' ? 'po' : 'js'; const extension = process.env.NODE_ENV === 'development' ? 'po' : 'js';
let { messages } = await import(`../../translations/${lang}/web.${extension}`); const { messages } = await import(`../../translations/${lang}/web.${extension}`);
if (extension === 'po') {
const { messages: commonMessages } = await import(
`../../translations/${lang}/common.${extension}`
);
messages = { ...messages, ...commonMessages };
}
return { return {
[lang]: messages, [lang]: messages,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2024-07-24 13:01+1000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: ro\n"
"Project-Id-Version: documenso-app\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-07-26 06:04\n"
"Last-Translator: \n"
"Language-Team: Romanian\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100>0 && n%100<20)) ? 1 : 2);\n"
"X-Crowdin-Project: documenso-app\n"
"X-Crowdin-Project-ID: 694691\n"
"X-Crowdin-Language: ro\n"
"X-Crowdin-File: common.po\n"
"X-Crowdin-File-ID: 4\n"

View File

@ -1,20 +0,0 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2024-07-24 13:01+1000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: ro\n"
"Project-Id-Version: documenso-app\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-07-26 06:04\n"
"Last-Translator: \n"
"Language-Team: Romanian\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100>0 && n%100<20)) ? 1 : 2);\n"
"X-Crowdin-Project: documenso-app\n"
"X-Crowdin-Project-ID: 694691\n"
"X-Crowdin-Language: ro\n"
"X-Crowdin-File: web.po\n"
"X-Crowdin-File-ID: 8\n"

View File

@ -9,17 +9,7 @@ import { APP_I18N_OPTIONS } from '../constants/i18n';
export async function dynamicActivate(i18nInstance: I18n, locale: string) { export async function dynamicActivate(i18nInstance: I18n, locale: string) {
const extension = process.env.NODE_ENV === 'development' ? 'po' : 'js'; const extension = process.env.NODE_ENV === 'development' ? 'po' : 'js';
let { messages } = await import(`../translations/${locale}/web.${extension}`); const { messages } = await import(`../translations/${locale}/web.${extension}`);
// Dirty way to load common messages for development since it's not compiled.
if (process.env.NODE_ENV === 'development') {
const commonMessages = await import(`../translations/${locale}/common.${extension}`);
messages = {
...messages,
...commonMessages.messages,
};
}
i18nInstance.loadAndActivate({ locale, messages }); i18nInstance.loadAndActivate({ locale, messages });
} }

View File

@ -33,9 +33,6 @@
"test:e2e": { "test:e2e": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
"cache": false "cache": false
},
"translate:compile": {
"cache": false
} }
}, },
"globalDependencies": ["**/.env.*local"], "globalDependencies": ["**/.env.*local"],