lingui.config.ts file in Twenty, the #1 open-source CRM.
In this article, we will review lingui.config.ts file in Twenty, the #1 open-source CRM. We will look at:
-
What is Lingui?
-
lingui.config.ts in Twenty
What is Lingui?
Lingui is an internationalization framework for global products.
It is a JavaScript library for internationalization (i18n) of JavaScript projects. Supports React (including RSC and React Native), Vue, Node.js, and more.
Why choose Lingui?
-
Universal
-
Powerful tooling
-
Full Rich-Text support
-
AI Translation Ready
-
Headache-Free Professional Localization
Workflow
-
Define Messages
-
Extract
-
Translate
-
Compile
-
Deploy
Example
import { Trans } from "@lingui/react/macro"
function App() {
return (
<Trans
id="msg.docs" // Optional message id
comment="Docs link on the website" // Comment for translators, optional
>
Read the <a href="https://lingui.dev">documentation</a>
for more info.
</Trans>
)
}
Configuration
By default, Lingui looks for the configuration in the following locations:
-
lingui.config.js
orlingui.config.ts
file exporting a configuration object (recommended). -
.linguirc
file in JSON format. -
lingui
section inpackage.json
.
You can also define the environment variable LINGUI_CONFIG
with the path to your config file.
Learn more about config
lingui.config.ts in Twenty
In twenty/packages/twenty-front/lingui.config.ts, you will find the following code:
import { defineConfig } from '@lingui/conf';
import { formatter } from '@lingui/format-po';
import { APP_LOCALES, SOURCE_LOCALE } from 'twenty-shared/translations';
export default defineConfig({
sourceLocale: 'en',
locales: Object.values(APP_LOCALES),
pseudoLocale: 'pseudo-en',
fallbackLocales: {
'pseudo-en': 'en',
default: SOURCE_LOCALE,
},
catalogs: [
{
path: '<rootDir>/src/locales/{locale}',
include: ['src'],
},
],
catalogsMergePath: '<rootDir>/src/locales/generated/{locale}',
compileNamespace: 'ts',
format: formatter({ lineNumbers: false, printLinguiId: true }),
});
For all the options defined in this above code, please refer to documentation.
About me
Hey, my name is Ramu Narasinga. I study codebase architecture in large open-source projects.
Email: ramu.narasinga@gmail.com