@payloadcms/translations
Advanced tools
Comparing version 3.0.0-beta.0 to 3.0.0-beta.1
export { importDateFNSLocale } from '../importDateFNSLocale.js' | ||
export { getTranslation } from '../utilities/getTranslation.js' | ||
export { initI18n, t } from '../utilities/init.js' | ||
export { acceptedLanguages, matchLanguage, rtlLanguages } from '../utilities/languages.js' | ||
export { acceptedLanguages, extractHeaderLanguage, rtlLanguages } from '../utilities/languages.js' | ||
export type * from '../types.js' |
export { importDateFNSLocale } from '../importDateFNSLocale.js'; | ||
export { getTranslation } from '../utilities/getTranslation.js'; | ||
export { initI18n, t } from '../utilities/init.js'; | ||
export { acceptedLanguages, matchLanguage, rtlLanguages } from '../utilities/languages.js'; | ||
export { acceptedLanguages, extractHeaderLanguage, rtlLanguages } from '../utilities/languages.js'; | ||
export type * from '../types.js'; | ||
//# sourceMappingURL=index.d.ts.map |
export { importDateFNSLocale } from '../importDateFNSLocale.js'; | ||
export { getTranslation } from '../utilities/getTranslation.js'; | ||
export { initI18n, t } from '../utilities/init.js'; | ||
export { acceptedLanguages, matchLanguage, rtlLanguages } from '../utilities/languages.js'; | ||
export { acceptedLanguages, extractHeaderLanguage, rtlLanguages } from '../utilities/languages.js'; | ||
//# sourceMappingURL=index.js.map |
import type { AcceptedLanguages } from '../types.js'; | ||
export declare const rtlLanguages: readonly ["ar", "fa"]; | ||
export declare const acceptedLanguages: readonly ["ar", "az", "bg", "cs", "de", "en", "es", "fa", "fr", "hr", "hu", "it", "ja", "ko", "my", "nb", "nl", "pl", "pt", "ro", "rs", "rsLatin", "ru", "sv", "th", "tr", "uk", "vi", "zh", "zh-TW"]; | ||
export declare function matchLanguage(acceptLanguageHeader: string): AcceptedLanguages | undefined; | ||
export declare function extractHeaderLanguage(acceptLanguageHeader: string): AcceptedLanguages | undefined; | ||
//# sourceMappingURL=languages.d.ts.map |
@@ -143,3 +143,3 @@ export const rtlLanguages = ['ar', 'fa']; | ||
} | ||
export function matchLanguage(acceptLanguageHeader) { | ||
export function extractHeaderLanguage(acceptLanguageHeader) { | ||
const parsedHeader = parseAcceptLanguage(acceptLanguageHeader); | ||
@@ -146,0 +146,0 @@ let matchedLanguage; |
{ | ||
"name": "@payloadcms/translations", | ||
"version": "3.0.0-beta.0", | ||
"version": "3.0.0-beta.1", | ||
"main": "./dist/exports/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/exports/index.d.ts", |
# Payload Translations | ||
These are the translations for Payload. Translations are used on both the server and the client. The admin panel uses translations to display text to the user in their selected language. The server uses translations when sending API responses. | ||
The home of Payloads API and Admin Panel translations. | ||
@@ -9,5 +9,4 @@ ## How to contribute | ||
1. Open the language file you wish to edit located within the `src/all` folder | ||
2. Update the translation value | ||
3. Run one of the following: | ||
1. Update the translation value | ||
2. Run one of the following: | ||
```sh | ||
@@ -23,5 +22,4 @@ yarn build | ||
1. Add the new translation key/value pair for all languages located in the `src/all` folder | ||
2. Open the `writeTranslationFiles.ts` file and add the key to either `clientTranslationKeys` or `serverTranslationKeys` depending on where the translation will be used. | ||
3. Run one of the following: | ||
1. Add the new translation key/value pair for **all** languages located in the `<payload-repo-root>/packages/translations/src/languages` folder | ||
2. Run one of the following: | ||
```sh | ||
@@ -37,6 +35,5 @@ yarn build | ||
1. Create a new JSON file in the `src/all` folder with the language code as the file name (e.g. `en.json` for English) | ||
2. Translate all of the keys in the new file | ||
3. Open the `src/index.ts` file and import your json file and then export it inside the `translations` object | ||
4. Run one of the following: | ||
1. Create a new TS file in the `<payload-repo-root>/packages/translations/src/languages` folder, use the language code as the file name (e.g. `<payload-repo-root>/packages/translations/src/languages/en.ts` for English) | ||
2. Copy all translations from an existing language file and update all of the translations to match your new language | ||
3. Run one of the following: | ||
```sh | ||
@@ -49,2 +46,4 @@ yarn build | ||
``` | ||
4. Import and export your new language file from within `<payload-repo-root>/packages/translations/src/exports/all.ts` | ||
5. Re-export the file from within `<payload-repo-root>/packages/payload/src/exports/i18n/[your-new-language].ts` | ||
@@ -51,0 +50,0 @@ Here is a full list of language keys. Note that these are not all implemented, but if you would like to contribute and add a new language, you can use this list as a reference: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1021704
163