Skip to content

Node.js module that allows you to easily interact with the Localazy API.

License

Notifications You must be signed in to change notification settings

localazy/api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f13c786 Β· Apr 18, 2025

History

36 Commits
Apr 17, 2025
Apr 17, 2025
Apr 18, 2024
Apr 17, 2025
Apr 17, 2025
Apr 17, 2025
Apr 15, 2024
Apr 17, 2025
Oct 19, 2023
Apr 17, 2025
Apr 17, 2025
Apr 18, 2025
Apr 18, 2025
Oct 19, 2023
Apr 18, 2024
Apr 17, 2025
Apr 18, 2025
Apr 18, 2025
Apr 17, 2025
Apr 17, 2025
Apr 17, 2025

Repository files navigation

Localazy

localazy-api

@localazy/api-client npm license

πŸ“¦ Localazy API Client

Node.js module that allows you to easily interact with the Localazy API.

πŸ”§ Install

npm install @localazy/api-client
# or you can use yarn or pnpm

πŸš€ Usage

ESM
import { ApiClient } from '@localazy/api-client';

const json = { en: { tooltip: 'Elegant unicorn' } }; // Get text to translate.

const api = new ApiClient({ authToken: 'your-project-token' }); // Create Api client.
const project = await api.projects.first(); // Get Localazy project.
const file = await api.import.json({ project, json }); // Import source keys.
const fr = await api.export.json({ project, file, langs: ['fr'] }); // Export translated keys.

console.log(fr); // πŸ¦„ { fr: { tooltip: 'Licorne Γ©lΓ©gante' } }
TypeScript
import { ApiClient, Project, I18nJson, Locales } from '@localazy/api-client';

const json: I18nJson = { en: { tooltip: 'Elegant unicorn' } };

const api: ApiClient = new ApiClient({ authToken: 'your-project-token' });
const project: Project = await api.projects.first();
const file: File = await api.import.json({ project, json: json });
const fr: I18nJson = await api.export.json({ project, file, langs: [Locales.FRENCH] });

πŸ” Project Token

You can obtain the project token at https://localazy.com/developer/tokens.

The project token is permitted to read and write to the single project.

πŸ“š Documentation

ℹ️ Links

πŸ›Ÿ Support

Join the Localazy Discussion Forum to discuss all things localization.

If you encounter any problems or have questions, you can use our forum, GitHub issues or contact us at team@localazy.com.

❀️ Localazy Ecosystem

Check out other npm packages from Localazy:

NPM package Description
cli @localazy/cli Localazy CLI tool.
localazy-api @localazy/api-client Localazy API client.
languages @localazy/languages List of all languages supported by Localazy.
strapi @localazy/strapi-plugin The official Localazy Strapi plugin.

Discover all available integration options and localization examples.

πŸ“œ License

Code released under the MIT license.