@justanarthur/payload-plugin-translator 3.3.2 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -303,8 +303,7 @@ var CustomButtonWithTranslator = ({ type }) => {
303
303
  if (!id && !globalSlug)
304
304
  return /* @__PURE__ */ jsx6(DefaultButton, {});
305
305
  const { localization } = config;
306
- const isSourceLocale = Boolean(localization) && locale.code === localization.defaultLocale;
307
- if (isSourceLocale)
306
+ if (localization && locale.code === localization.defaultLocale)
308
307
  return /* @__PURE__ */ jsx6(DefaultButton, {});
309
308
  return /* @__PURE__ */ jsx6(TranslatorProvider, {
310
309
  children: /* @__PURE__ */ jsxs4("div", {
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  isTranslateMode,
9
9
  createTranslateTask2,
10
10
  createTranslateWorkflow2
11
- } from "./shared/chunk-kxdj1t2m.js";
11
+ } from "./shared/chunk-12hf0kdf.js";
12
12
  import"./shared/chunk-pmxe5c20.js";
13
13
  import {
14
14
  readLocales,
package/dist/jobs.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createAutoTranslateGlobalHook2,
4
4
  createTranslateTask2,
5
5
  createTranslateWorkflow2
6
- } from "./shared/chunk-kxdj1t2m.js";
6
+ } from "./shared/chunk-12hf0kdf.js";
7
7
  import {
8
8
  TRANSLATE_TASK_SLUG2,
9
9
  TRANSLATE_WORKFLOW_SLUG2
@@ -107,10 +107,9 @@ var translateOperation2 = async (args) => {
107
107
  payload: args.payload
108
108
  };
109
109
  const { collectionSlug, globalSlug, id, locale, localeFrom, overrideAccess } = args;
110
- const localization = req.payload.config.localization;
111
- const defaultLocale = localization ? localization.defaultLocale : undefined;
112
- if (defaultLocale && locale === defaultLocale) {
113
- throw new APIError3(`Refusing to translate into the default locale "${defaultLocale}" — it is the source of truth. Translate from it into a target locale instead.`, 400);
110
+ const { localization } = req.payload.config;
111
+ if (localization && locale === localization.defaultLocale) {
112
+ throw new APIError3(`Refusing to translate into the default locale "${localization.defaultLocale}" — it is the source of truth. Translate from it into a target locale instead.`, 400);
114
113
  }
115
114
  const { config, doc: dataFrom } = await findEntityWithConfig({
116
115
  collectionSlug,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justanarthur/payload-plugin-translator",
3
3
  "description": "Translator plugin for Payload CMS — automatic localization via Google, OpenAI, LibreTranslate, or custom resolvers.",
4
- "version": "3.3.2",
4
+ "version": "3.3.3",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "files": [