Shared i18n translation files for LogoBaker applications.
We welcome contributions! See CONTRIBUTING.md for the full guide.
Quick summary:
- Fork & clone the repo
- Create a branch (
git checkout -b feat/add-german-translations) - Make your changes and run
npm run validate - Commit using Conventional Commits (e.g.
feat: add German translations) - Open a Pull Request against
main
Add to your project's .npmrc (or globally in ~/.npmrc):
@logobaker:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
How to get a token: Go to GitHub → Settings → Developer settings → Personal access tokens (classic) and create a token with the
read:packagesscope.
⚠️ GitHub Packages requires authentication even for public packages. To avoid committing your token, add it to your global~/.npmrcinstead of the project-level file.
npm install @logobaker/logobaker-i18nimport { loadTranslation, getLocalesPath } from '@logobaker/logobaker-i18n';
// Load a specific namespace
const en = loadTranslation('en', 'common');
console.log(en.auth.login); // "Log In"
// Or get the path for i18next-fs-backend
const localesPath = getLocalesPath();
// => "/path/to/node_modules/@logobaker/logobaker-i18n/locales"// In your i18n config, point the loader to the package's locales:
import { getLocalesPath } from '@logobaker/logobaker-i18n';
// Or import JSON directly:
import en from '@logobaker/logobaker-i18n/dist/locales/en/common.json';
import uk from '@logobaker/logobaker-i18n/dist/locales/uk/common.json';import en from '@logobaker/logobaker-i18n/dist/locales/en/common.json';
import uk from '@logobaker/logobaker-i18n/dist/locales/uk/common.json';
i18n.init({
resources: {
en: { common: en },
uk: { common: uk },
},
defaultNS: 'common',
lng: 'en',
});- Create a new folder under
locales/, e.g.locales/de/ - Copy
locales/en/common.jsoninto it - Translate all values
- Add the locale code to
src/index.ts→Localetype andLOCALESarray - Run
npm run validateto check consistency - Commit, push, and create a new GitHub release to publish
- Create a new JSON file in every locale folder, e.g.
locales/en/dashboard.json,locales/uk/dashboard.json - Use the same key structure in each locale
- Run
npm run validate
Releases are fully automated based on Conventional Commits. Just push to main and the workflow handles versioning, tagging, GitHub Release creation, and npm publishing.
| Commit prefix | Example | Version bump |
|---|---|---|
fix: |
fix: correct typo in uk locale |
patch (1.0.0 → 1.0.1) |
feat: |
feat: add German translations |
minor (1.0.0 → 1.1.0) |
feat!: or BREAKING CHANGE: |
feat!: restructure namespace keys |
major (1.0.0 → 2.0.0) |
| anything else | docs: update readme |
patch (1.0.0 → 1.0.1) |
# Add a new translation file
git add locales/de/common.json
git commit -m "feat: add German translations"
git push origin main
# → auto-releases v1.1.0 and publishes to GitHub Packagesnpm run validateChecks that:
- All locales have the same JSON files
- All JSON files have the same nested key structure
- No missing or extra keys
MIT