Getting started
Installation
Prerequisites
- Node.js version 18 or higher.
- A package manager: e.g. npm, pnpm, ...
sh
$ npm add @ogs-gmbh/lexorash
$ pnpm add @ogs-gmbh/lexorash
$ yarn add @ogs-gmbh/lexorash
$ bun add @ogs-gmbh/lexoraUsage
lexora provides a general facility for adapters and server/client integration, but it does not handle the loading of translations. Please refer to adapters for getting a better understanding. In the following example, we use lexora-postgres-adapter inside a Next.js layout, that will load translations from a Postgres database.
layout.tsx
tsx
import { getTranslations } from "@ogs-gmbh/lexora/server";
import { LexoraProvider } from "@ogs-gmbh/lexora/client";
import { postgresAdapter } from "@ogs-gmbh/lexora-postgres-adapter";
function RootLayout() {
const translations = await getTranslations({
locale: "de",
adapters: [postgresAdapter("postgres://admin:root@127.0.0.1:5432/default")]
});
return (
<html>
<body>
<LexoraProvider data={translations}>{children}</LexoraProvider>
</body>
</html>
);
}
export default RootLayout;You're now able to translate by server and client components. Enjoy ⭐.