payload 1.1.28-beta.0 → 1.2.0

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +11 -99
  2. package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.d.ts +3 -3
  3. package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.js +7 -7
  4. package/dist/admin/components/forms/Form/buildStateFromSchema/index.d.ts +2 -2
  5. package/dist/admin/components/forms/Form/buildStateFromSchema/index.js +2 -2
  6. package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.d.ts +3 -3
  7. package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.js +2 -2
  8. package/dist/admin/components/forms/Form/index.js +4 -4
  9. package/dist/admin/components/forms/field-types/Array/index.js +2 -2
  10. package/dist/admin/components/forms/field-types/Blocks/index.js +2 -2
  11. package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.js +2 -2
  12. package/dist/admin/components/forms/field-types/RichText/elements/link/Button.js +2 -2
  13. package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
  14. package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.js +2 -2
  15. package/dist/admin/components/forms/useField/index.js +2 -2
  16. package/dist/admin/components/utilities/I18n/index.js +4 -1
  17. package/dist/admin/components/views/Account/index.js +4 -4
  18. package/dist/admin/components/views/Global/index.js +5 -5
  19. package/dist/admin/components/views/collections/Edit/Auth/APIKey.js +2 -2
  20. package/dist/admin/components/views/collections/Edit/Default.js +3 -2
  21. package/dist/admin/components/views/collections/Edit/index.js +4 -4
  22. package/dist/auth/executeAccess.js +3 -3
  23. package/dist/auth/getExecuteStaticAccess.js +2 -2
  24. package/dist/auth/operations/forgotPassword.js +5 -5
  25. package/dist/auth/operations/local/forgotPassword.js +3 -1
  26. package/dist/auth/operations/local/login.js +3 -1
  27. package/dist/auth/operations/local/resetPassword.js +3 -1
  28. package/dist/auth/operations/local/unlock.js +3 -1
  29. package/dist/auth/operations/login.js +4 -4
  30. package/dist/auth/operations/logout.js +2 -2
  31. package/dist/auth/operations/refresh.js +2 -2
  32. package/dist/auth/operations/registerFirstUser.js +2 -2
  33. package/dist/auth/sendVerificationEmail.js +3 -3
  34. package/dist/collections/operations/create.js +4 -4
  35. package/dist/collections/operations/delete.js +6 -6
  36. package/dist/collections/operations/findByID.js +4 -4
  37. package/dist/collections/operations/findVersionByID.js +5 -5
  38. package/dist/collections/operations/local/create.js +3 -1
  39. package/dist/collections/operations/local/delete.js +3 -1
  40. package/dist/collections/operations/local/find.js +3 -1
  41. package/dist/collections/operations/local/findByID.js +3 -1
  42. package/dist/collections/operations/local/findVersionByID.js +3 -1
  43. package/dist/collections/operations/local/findVersions.js +5 -2
  44. package/dist/collections/operations/local/restoreVersion.js +4 -2
  45. package/dist/collections/operations/local/update.js +5 -2
  46. package/dist/collections/operations/restoreVersion.js +5 -5
  47. package/dist/collections/operations/update.js +6 -6
  48. package/dist/collections/requestHandlers/create.js +2 -2
  49. package/dist/collections/requestHandlers/delete.js +2 -2
  50. package/dist/collections/requestHandlers/restoreVersion.js +2 -2
  51. package/dist/collections/requestHandlers/update.js +4 -4
  52. package/dist/errors/AuthenticationError.d.ts +2 -2
  53. package/dist/errors/AuthenticationError.js +3 -3
  54. package/dist/errors/ErrorDeletingFile.d.ts +2 -2
  55. package/dist/errors/ErrorDeletingFile.js +3 -3
  56. package/dist/errors/FileUploadError.d.ts +2 -2
  57. package/dist/errors/FileUploadError.js +3 -3
  58. package/dist/errors/Forbidden.d.ts +2 -2
  59. package/dist/errors/Forbidden.js +3 -3
  60. package/dist/errors/LockedAuth.d.ts +2 -2
  61. package/dist/errors/LockedAuth.js +3 -3
  62. package/dist/errors/MissingFile.d.ts +2 -2
  63. package/dist/errors/MissingFile.js +3 -3
  64. package/dist/errors/NotFound.d.ts +2 -2
  65. package/dist/errors/NotFound.js +3 -3
  66. package/dist/errors/UnathorizedError.d.ts +2 -2
  67. package/dist/errors/UnathorizedError.js +3 -3
  68. package/dist/errors/ValidationError.d.ts +2 -2
  69. package/dist/errors/ValidationError.js +3 -3
  70. package/dist/express/middleware/i18n.js +3 -3
  71. package/dist/express/types.d.ts +2 -1
  72. package/dist/fields/config/types.d.ts +2 -2
  73. package/dist/fields/hooks/beforeChange/index.js +2 -2
  74. package/dist/fields/hooks/beforeChange/promise.js +2 -2
  75. package/dist/fields/validations.js +51 -51
  76. package/dist/fields/validations.spec.js +2 -3
  77. package/dist/globals/operations/findVersionByID.js +5 -5
  78. package/dist/globals/operations/local/findOne.js +5 -1
  79. package/dist/globals/operations/local/findVersionByID.js +5 -1
  80. package/dist/globals/operations/local/findVersions.js +5 -1
  81. package/dist/globals/operations/local/restoreVersion.js +5 -1
  82. package/dist/globals/operations/local/update.js +5 -1
  83. package/dist/globals/operations/restoreVersion.js +3 -3
  84. package/dist/globals/requestHandlers/restoreVersion.js +2 -2
  85. package/dist/globals/requestHandlers/update.js +4 -4
  86. package/dist/preferences/operations/delete.js +2 -2
  87. package/dist/preferences/operations/findOne.js +2 -2
  88. package/dist/preferences/operations/update.js +2 -2
  89. package/dist/preferences/requestHandlers/delete.js +2 -2
  90. package/dist/preferences/requestHandlers/findOne.js +2 -2
  91. package/dist/preferences/requestHandlers/update.js +2 -2
  92. package/dist/translations/init.d.ts +2 -2
  93. package/dist/translations/init.js +4 -1
  94. package/dist/uploads/generateFileData.js +3 -3
  95. package/dist/uploads/uploadFiles.d.ts +2 -2
  96. package/dist/uploads/uploadFiles.js +3 -3
  97. package/docs/configuration/i18n.mdx +1 -1
  98. package/docs/fields/overview.mdx +1 -1
  99. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,130 +1,42 @@
1
1
 
2
2
 
3
- ## [1.1.28-beta.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.1.28-beta.0) (2022-11-17)
3
+ # [1.2.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.2.0) (2022-11-18)
4
4
 
5
5
 
6
6
  ### Bug Fixes
7
7
 
8
- * allow label to be set to false ([858fc86](https://github.com/payloadcms/payload/commit/858fc86af895f25a091f1b5b729d04c86f654601))
9
- * autosave slug regression ([b1f3ce9](https://github.com/payloadcms/payload/commit/b1f3ce9735743b8056633d98fb94353e6f4c08e6))
10
8
  * build errors ([65f0e1c](https://github.com/payloadcms/payload/commit/65f0e1caace193f034139e331883d01d8eb92d2c))
11
9
  * components optional chaining ([d5e725c](https://github.com/payloadcms/payload/commit/d5e725c608588e96b974291fa86d5e89dea9060d))
12
10
  * corrects exported custom component type ([2878b4b](https://github.com/payloadcms/payload/commit/2878b4b1bec5c0c9997c1ba2a080640d4d3f8e5f))
13
11
  * corrects type for CollapsibleLabel example type, adjusts custom component filenames ([ccb4231](https://github.com/payloadcms/payload/commit/ccb42319abf0679d998e15b6b47fff3ce95d4ca1))
14
- * getTranslation fallback ([d82a6be](https://github.com/payloadcms/payload/commit/d82a6be5012a355d0eed98ac57c79a6f1d3c7f32))
15
- * radio and select fields show translated value in list view ([13d225f](https://github.com/payloadcms/payload/commit/13d225ff086c8913a8954dd83e658af5859028bc))
16
12
  * sets pointer-events to none so the entire label bar is clickable ([e458087](https://github.com/payloadcms/payload/commit/e458087a55cbbad29ca3568ca4c089aaee49693a))
17
- * translation formatting ([d9ddca9](https://github.com/payloadcms/payload/commit/d9ddca9d1b7276a1ed3603ceb78399bd45624032))
18
- * translation typos ([0ed38d4](https://github.com/payloadcms/payload/commit/0ed38d47081b351e70854cc11bdb0efe1ec971ac))
19
- * type error ([6a5bd24](https://github.com/payloadcms/payload/commit/6a5bd24fd125464522b9d27e724efa435fb621a4))
20
13
 
21
14
 
22
15
  ### Features
23
16
 
24
- * add Dutch translations ([#1418](https://github.com/payloadcms/payload/issues/1418)) ([c58ed21](https://github.com/payloadcms/payload/commit/c58ed213c6a879612e0ebe6ac11a4b0f4ab95a1d))
25
- * Add french translations ([#1421](https://github.com/payloadcms/payload/issues/1421)) ([118886e](https://github.com/payloadcms/payload/commit/118886e2ef073464fde432243a9205ce92762282))
26
- * add i18n to admin panel ([d910045](https://github.com/payloadcms/payload/commit/d910045102b2e80c12c96f13941d8d624abbecf5))
27
- * add i18n to local api ([f143f72](https://github.com/payloadcms/payload/commit/f143f724fee85b51697ad54110a0920a398baced))
28
- * Add Italian Translations ([#1335](https://github.com/payloadcms/payload/issues/1335)) ([97c28c8](https://github.com/payloadcms/payload/commit/97c28c809614962a1be795082ed84dbfc2299e79))
29
- * Add Japanese Translations ([#1351](https://github.com/payloadcms/payload/issues/1351)) ([522576c](https://github.com/payloadcms/payload/commit/522576c2b98368f14fe0bf945c703f866bb7646b))
30
- * add language select input to account ([ccee1d8](https://github.com/payloadcms/payload/commit/ccee1d84d4247dc894bf15227728cbb29f924d21))
31
- * add polish translations ([#1328](https://github.com/payloadcms/payload/issues/1328)) ([7e218fe](https://github.com/payloadcms/payload/commit/7e218feb911bcda312f2732266a63c3eccb285a2))
32
- * Add Russian Translations ([#1334](https://github.com/payloadcms/payload/issues/1334)) ([9980765](https://github.com/payloadcms/payload/commit/99807657ba97d68c5d3457794745d4182715abfa))
33
- * Add Spanish Translations ([#1327](https://github.com/payloadcms/payload/issues/1327)) ([edf6877](https://github.com/payloadcms/payload/commit/edf687792489fbc969ba0a0f0f6aab69f637cebe))
34
- * Add swedish translations ([#1429](https://github.com/payloadcms/payload/issues/1429)) ([ba8f739](https://github.com/payloadcms/payload/commit/ba8f7390cabc514735c76c32266be792b0f4596d))
35
- * add Vietnamese translation for the admin panel ([#1346](https://github.com/payloadcms/payload/issues/1346)) ([47f45fa](https://github.com/payloadcms/payload/commit/47f45fae150779ec319bbb35b91469baaa308688))
17
+ * add i18n to admin panel ([#1326](https://github.com/payloadcms/payload/issues/1326)) ([bab34d8](https://github.com/payloadcms/payload/commit/bab34d82f5fddad32ceafd116ad97e87cab4c862))
36
18
  * adds docs example ([2bf0fff](https://github.com/payloadcms/payload/commit/2bf0fffa0dd83f395aa3318b3baba1e22dd58b51))
37
19
  * adds playwright tests for array fields ([57a8c35](https://github.com/payloadcms/payload/commit/57a8c352e44750d1785b65074c15812dc8226585))
38
- * allow custom translations in payload config ([16d1c53](https://github.com/payloadcms/payload/commit/16d1c53b8d18c2924644103713b4d785757764dd))
39
- * collection and globals description support i18n ([f39898b](https://github.com/payloadcms/payload/commit/f39898b784cd1fe252fdaeaf97d242a3afef2f36))
40
20
  * converts rowHeader to collapsibleLabel, extends data passed to functions/components ([13ec1e0](https://github.com/payloadcms/payload/commit/13ec1e0398d2a9ce1aeddc5692008173acfde45e))
41
21
  * customizable header-labels ([d45de99](https://github.com/payloadcms/payload/commit/d45de99956273c59e6d1a3a11c7cce36f3d123f6))
42
- * fields translations ([a7008de](https://github.com/payloadcms/payload/commit/a7008def47d8701d371d0f312148d98259a607d4))
43
- * GraphQL schema uses names and slugs instead of labels, introduces graphQL names for compatibility ([508faa0](https://github.com/payloadcms/payload/commit/508faa05b20adfd5d218dbb4cb56db890e8c4345))
44
- * i18n base field labels ([fd675f9](https://github.com/payloadcms/payload/commit/fd675f9341bbd9461c418a03ed837c577fdb1ed9))
45
- * i18n errors ([25294d1](https://github.com/payloadcms/payload/commit/25294d1e8b10d7e516fda5894062836fc9ae312f))
46
- * i18n labels blocks ([650d8ab](https://github.com/payloadcms/payload/commit/650d8aba0efe4ddd9e561b78d932fe250be077a4))
47
- * i18n labels, descriptions, placeholders, tabs and nav groups ([ca18afc](https://github.com/payloadcms/payload/commit/ca18afcd994bb3b56548b9c6e10e81907e2542ef))
48
- * i18n translated auth emails, request handlers, operations ([4c6847d](https://github.com/payloadcms/payload/commit/4c6847d303c38c34f31c1508ba52e80828aef733))
49
- * make translations for german language ([#1331](https://github.com/payloadcms/payload/issues/1331)) ([cdfcd0f](https://github.com/payloadcms/payload/commit/cdfcd0f216e40654234e331d47e47bd70f08c459))
50
- * make typescript interface configurable for globals and collections and default to slugs instead of labels ([1ecf2a9](https://github.com/payloadcms/payload/commit/1ecf2a9a06fa334dd9af31600bdefa73d9c0410b))
51
- * nav group translations ([a61748a](https://github.com/payloadcms/payload/commit/a61748a233f968c6b339d3816b0497a459791ac0))
52
22
  * simplifies collapsible label API, adds e2e tests ([d9df98f](https://github.com/payloadcms/payload/commit/d9df98ff22041908fc2ce0972c844116edd409be))
53
23
  * specifies component names for arrays/collapsibles, simplifies threaded data ([b74ea21](https://github.com/payloadcms/payload/commit/b74ea218ca47ce9db9d20586dbbce73e4ce0f917))
54
- * translation of elements ([3820840](https://github.com/payloadcms/payload/commit/382084051db5d09b95eef1731b3f94708c5caace))
55
- * translation of views ([9d966cf](https://github.com/payloadcms/payload/commit/9d966cf368a42254e0900f997f2def4a0d972b14))
56
- * translations upload and list ([3d88b61](https://github.com/payloadcms/payload/commit/3d88b618fa3bd5cc5288b05b6ffc1bc25caf9150))
57
- * translations: authentication, upload, edit, theme ([24d356e](https://github.com/payloadcms/payload/commit/24d356e3f662ad3288b17439b62fc8a6cf3d9552))
58
- * validation i18n ([cd38e9d](https://github.com/payloadcms/payload/commit/cd38e9d8ac4ea53112a698e5596f158b464354a0))
59
24
 
60
25
 
61
26
  ### BREAKING CHANGES
62
27
 
63
- * labels are no longer used for generating typescript interface names. To prevent breaking changes, set the property with the new configuration option
64
- * GraphQL queries and mutation names are no longer based on the labels and could change if you make use of labels that differ from the slug. Consider using new graphQL properties on collections and graphQLName on globals as a way to set the name explicitly to maintain existing GraphQL implementations.
65
-
66
- ## [1.1.27-beta.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.1.27-beta.0) (2022-11-17)
67
-
28
+ * If you assigned labels to collections, globals or block names, you need to update your config! Your GraphQL schema and generated Typescript interfaces may have changed. Payload no longer uses labels for code based naming. To prevent breaking changes to your GraphQL API and typescript types in your project, you can assign the below properties to match what Payload previously generated for you from labels.
68
29
 
69
- ### Bug Fixes
30
+ On Collections
31
+ Use `graphQL.singularName`, `graphQL.pluralName` for GraphQL schema names.
32
+ Use `typescript.interface` for typescript generation name.
70
33
 
71
- * allow label to be set to false ([858fc86](https://github.com/payloadcms/payload/commit/858fc86af895f25a091f1b5b729d04c86f654601))
72
- * autosave slug regression ([b1f3ce9](https://github.com/payloadcms/payload/commit/b1f3ce9735743b8056633d98fb94353e6f4c08e6))
73
- * build errors ([65f0e1c](https://github.com/payloadcms/payload/commit/65f0e1caace193f034139e331883d01d8eb92d2c))
74
- * components optional chaining ([d5e725c](https://github.com/payloadcms/payload/commit/d5e725c608588e96b974291fa86d5e89dea9060d))
75
- * corrects exported custom component type ([2878b4b](https://github.com/payloadcms/payload/commit/2878b4b1bec5c0c9997c1ba2a080640d4d3f8e5f))
76
- * corrects type for CollapsibleLabel example type, adjusts custom component filenames ([ccb4231](https://github.com/payloadcms/payload/commit/ccb42319abf0679d998e15b6b47fff3ce95d4ca1))
77
- * getTranslation fallback ([d82a6be](https://github.com/payloadcms/payload/commit/d82a6be5012a355d0eed98ac57c79a6f1d3c7f32))
78
- * radio and select fields show translated value in list view ([13d225f](https://github.com/payloadcms/payload/commit/13d225ff086c8913a8954dd83e658af5859028bc))
79
- * sets pointer-events to none so the entire label bar is clickable ([e458087](https://github.com/payloadcms/payload/commit/e458087a55cbbad29ca3568ca4c089aaee49693a))
80
- * translation formatting ([d9ddca9](https://github.com/payloadcms/payload/commit/d9ddca9d1b7276a1ed3603ceb78399bd45624032))
81
- * translation typos ([0ed38d4](https://github.com/payloadcms/payload/commit/0ed38d47081b351e70854cc11bdb0efe1ec971ac))
82
- * type error ([6a5bd24](https://github.com/payloadcms/payload/commit/6a5bd24fd125464522b9d27e724efa435fb621a4))
83
-
84
-
85
- ### Features
86
-
87
- * add Dutch translations ([#1418](https://github.com/payloadcms/payload/issues/1418)) ([c58ed21](https://github.com/payloadcms/payload/commit/c58ed213c6a879612e0ebe6ac11a4b0f4ab95a1d))
88
- * Add french translations ([#1421](https://github.com/payloadcms/payload/issues/1421)) ([118886e](https://github.com/payloadcms/payload/commit/118886e2ef073464fde432243a9205ce92762282))
89
- * add i18n to admin panel ([d910045](https://github.com/payloadcms/payload/commit/d910045102b2e80c12c96f13941d8d624abbecf5))
90
- * add i18n to local api ([f143f72](https://github.com/payloadcms/payload/commit/f143f724fee85b51697ad54110a0920a398baced))
91
- * Add Italian Translations ([#1335](https://github.com/payloadcms/payload/issues/1335)) ([97c28c8](https://github.com/payloadcms/payload/commit/97c28c809614962a1be795082ed84dbfc2299e79))
92
- * Add Japanese Translations ([#1351](https://github.com/payloadcms/payload/issues/1351)) ([522576c](https://github.com/payloadcms/payload/commit/522576c2b98368f14fe0bf945c703f866bb7646b))
93
- * add language select input to account ([ccee1d8](https://github.com/payloadcms/payload/commit/ccee1d84d4247dc894bf15227728cbb29f924d21))
94
- * add polish translations ([#1328](https://github.com/payloadcms/payload/issues/1328)) ([7e218fe](https://github.com/payloadcms/payload/commit/7e218feb911bcda312f2732266a63c3eccb285a2))
95
- * Add Russian Translations ([#1334](https://github.com/payloadcms/payload/issues/1334)) ([9980765](https://github.com/payloadcms/payload/commit/99807657ba97d68c5d3457794745d4182715abfa))
96
- * Add Spanish Translations ([#1327](https://github.com/payloadcms/payload/issues/1327)) ([edf6877](https://github.com/payloadcms/payload/commit/edf687792489fbc969ba0a0f0f6aab69f637cebe))
97
- * Add swedish translations ([#1429](https://github.com/payloadcms/payload/issues/1429)) ([ba8f739](https://github.com/payloadcms/payload/commit/ba8f7390cabc514735c76c32266be792b0f4596d))
98
- * add Vietnamese translation for the admin panel ([#1346](https://github.com/payloadcms/payload/issues/1346)) ([47f45fa](https://github.com/payloadcms/payload/commit/47f45fae150779ec319bbb35b91469baaa308688))
99
- * adds docs example ([2bf0fff](https://github.com/payloadcms/payload/commit/2bf0fffa0dd83f395aa3318b3baba1e22dd58b51))
100
- * adds playwright tests for array fields ([57a8c35](https://github.com/payloadcms/payload/commit/57a8c352e44750d1785b65074c15812dc8226585))
101
- * allow custom translations in payload config ([16d1c53](https://github.com/payloadcms/payload/commit/16d1c53b8d18c2924644103713b4d785757764dd))
102
- * collection and globals description support i18n ([f39898b](https://github.com/payloadcms/payload/commit/f39898b784cd1fe252fdaeaf97d242a3afef2f36))
103
- * converts rowHeader to collapsibleLabel, extends data passed to functions/components ([13ec1e0](https://github.com/payloadcms/payload/commit/13ec1e0398d2a9ce1aeddc5692008173acfde45e))
104
- * customizable header-labels ([d45de99](https://github.com/payloadcms/payload/commit/d45de99956273c59e6d1a3a11c7cce36f3d123f6))
105
- * fields translations ([a7008de](https://github.com/payloadcms/payload/commit/a7008def47d8701d371d0f312148d98259a607d4))
106
- * GraphQL schema uses names and slugs instead of labels, introduces graphQL names for compatibility ([508faa0](https://github.com/payloadcms/payload/commit/508faa05b20adfd5d218dbb4cb56db890e8c4345))
107
- * i18n base field labels ([fd675f9](https://github.com/payloadcms/payload/commit/fd675f9341bbd9461c418a03ed837c577fdb1ed9))
108
- * i18n errors ([25294d1](https://github.com/payloadcms/payload/commit/25294d1e8b10d7e516fda5894062836fc9ae312f))
109
- * i18n labels blocks ([650d8ab](https://github.com/payloadcms/payload/commit/650d8aba0efe4ddd9e561b78d932fe250be077a4))
110
- * i18n labels, descriptions, placeholders, tabs and nav groups ([ca18afc](https://github.com/payloadcms/payload/commit/ca18afcd994bb3b56548b9c6e10e81907e2542ef))
111
- * i18n translated auth emails, request handlers, operations ([4c6847d](https://github.com/payloadcms/payload/commit/4c6847d303c38c34f31c1508ba52e80828aef733))
112
- * make translations for german language ([#1331](https://github.com/payloadcms/payload/issues/1331)) ([cdfcd0f](https://github.com/payloadcms/payload/commit/cdfcd0f216e40654234e331d47e47bd70f08c459))
113
- * make typescript interface configurable for globals and collections and default to slugs instead of labels ([1ecf2a9](https://github.com/payloadcms/payload/commit/1ecf2a9a06fa334dd9af31600bdefa73d9c0410b))
114
- * nav group translations ([a61748a](https://github.com/payloadcms/payload/commit/a61748a233f968c6b339d3816b0497a459791ac0))
115
- * simplifies collapsible label API, adds e2e tests ([d9df98f](https://github.com/payloadcms/payload/commit/d9df98ff22041908fc2ce0972c844116edd409be))
116
- * specifies component names for arrays/collapsibles, simplifies threaded data ([b74ea21](https://github.com/payloadcms/payload/commit/b74ea218ca47ce9db9d20586dbbce73e4ce0f917))
117
- * translation of elements ([3820840](https://github.com/payloadcms/payload/commit/382084051db5d09b95eef1731b3f94708c5caace))
118
- * translation of views ([9d966cf](https://github.com/payloadcms/payload/commit/9d966cf368a42254e0900f997f2def4a0d972b14))
119
- * translations upload and list ([3d88b61](https://github.com/payloadcms/payload/commit/3d88b618fa3bd5cc5288b05b6ffc1bc25caf9150))
120
- * translations: authentication, upload, edit, theme ([24d356e](https://github.com/payloadcms/payload/commit/24d356e3f662ad3288b17439b62fc8a6cf3d9552))
121
- * validation i18n ([cd38e9d](https://github.com/payloadcms/payload/commit/cd38e9d8ac4ea53112a698e5596f158b464354a0))
122
-
123
-
124
- ### BREAKING CHANGES
34
+ On Globals
35
+ Use `graphQL.name` for GraphQL Schema name.
36
+ Use `typescript.interface` for typescript generation name.
125
37
 
126
- * labels are no longer used for generating typescript interface names. To prevent breaking changes, set the property with the new configuration option
127
- * GraphQL queries and mutation names are no longer based on the labels and could change if you make use of labels that differ from the slug. Consider using new graphQL properties on collections and graphQLName on globals as a way to set the name explicitly to maintain existing GraphQL implementations.
38
+ On Blocks (within Block fields)
39
+ Use `graphQL.singularName` for graphQL schema names.
128
40
 
129
41
  ## [1.1.26](https://github.com/payloadcms/payload/compare/v1.1.25...v1.1.26) (2022-11-15)
130
42
 
@@ -1,4 +1,4 @@
1
- import { i18n as Ii18n } from 'i18next';
1
+ import type { TFunction } from 'i18next';
2
2
  import { User } from '../../../../../auth';
3
3
  import { NonPresentationalField } from '../../../../../fields/config/types';
4
4
  import { Fields, Data } from '../types';
@@ -14,7 +14,7 @@ declare type Args = {
14
14
  operation: 'create' | 'update';
15
15
  data: Data;
16
16
  fullData: Data;
17
- i18n: Ii18n;
17
+ t: TFunction;
18
18
  };
19
- export declare const addFieldStatePromise: ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, i18n, }: Args) => Promise<void>;
19
+ export declare const addFieldStatePromise: ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, t, }: Args) => Promise<void>;
20
20
  export {};
@@ -3,7 +3,7 @@ import ObjectID from 'bson-objectid';
3
3
  import { fieldAffectsData, fieldHasSubFields, tabHasName, } from '../../../../../fields/config/types';
4
4
  import getValueWithDefault from '../../../../../fields/getDefaultValue';
5
5
  import { iterateFields } from './iterateFields';
6
- export const addFieldStatePromise = async ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, i18n, }) => {
6
+ export const addFieldStatePromise = async ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, t, }) => {
7
7
  var _a;
8
8
  if (fieldAffectsData(field)) {
9
9
  const fieldState = {
@@ -27,7 +27,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
27
27
  siblingData: data,
28
28
  id,
29
29
  operation,
30
- i18n,
30
+ t,
31
31
  });
32
32
  }
33
33
  if (typeof validationResult === 'string') {
@@ -59,7 +59,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
59
59
  id,
60
60
  locale,
61
61
  operation,
62
- i18n,
62
+ t,
63
63
  });
64
64
  });
65
65
  // Add values to field state
@@ -105,7 +105,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
105
105
  operation,
106
106
  fieldPromises,
107
107
  id,
108
- i18n,
108
+ t,
109
109
  });
110
110
  }
111
111
  });
@@ -132,7 +132,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
132
132
  path: `${path}${field.name}.`,
133
133
  locale,
134
134
  user,
135
- i18n,
135
+ t,
136
136
  });
137
137
  break;
138
138
  }
@@ -159,7 +159,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
159
159
  id,
160
160
  locale,
161
161
  operation,
162
- i18n,
162
+ t,
163
163
  });
164
164
  }
165
165
  else if (field.type === 'tabs') {
@@ -176,7 +176,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
176
176
  id,
177
177
  locale,
178
178
  operation,
179
- i18n,
179
+ t,
180
180
  });
181
181
  });
182
182
  }
@@ -1,4 +1,4 @@
1
- import { i18n as Ii18n } from 'i18next';
1
+ import type { TFunction } from 'i18next';
2
2
  import { User } from '../../../../../auth';
3
3
  import { Field as FieldSchema } from '../../../../../fields/config/types';
4
4
  import { Fields, Data } from '../types';
@@ -10,7 +10,7 @@ declare type Args = {
10
10
  id?: string | number;
11
11
  operation?: 'create' | 'update';
12
12
  locale: string;
13
- i18n: Ii18n;
13
+ t: TFunction;
14
14
  };
15
15
  declare const buildStateFromSchema: (args: Args) => Promise<Fields>;
16
16
  export default buildStateFromSchema;
@@ -1,6 +1,6 @@
1
1
  import { iterateFields } from './iterateFields';
2
2
  const buildStateFromSchema = async (args) => {
3
- const { fieldSchema, data: fullData = {}, user, id, operation, locale, i18n, } = args;
3
+ const { fieldSchema, data: fullData = {}, user, id, operation, locale, t, } = args;
4
4
  if (fieldSchema) {
5
5
  const fieldPromises = [];
6
6
  const state = {};
@@ -16,7 +16,7 @@ const buildStateFromSchema = async (args) => {
16
16
  data: fullData,
17
17
  fullData,
18
18
  parentPassesCondition: true,
19
- i18n,
19
+ t,
20
20
  });
21
21
  await Promise.all(fieldPromises);
22
22
  return state;
@@ -1,4 +1,4 @@
1
- import { i18n as Ii18n } from 'i18next';
1
+ import type { TFunction } from 'i18next';
2
2
  import { User } from '../../../../../auth';
3
3
  import { Field as FieldSchema } from '../../../../../fields/config/types';
4
4
  import { Fields, Data } from '../types';
@@ -14,7 +14,7 @@ declare type Args = {
14
14
  fieldPromises: Promise<void>[];
15
15
  id: string | number;
16
16
  operation: 'create' | 'update';
17
- i18n: Ii18n;
17
+ t: TFunction;
18
18
  };
19
- export declare const iterateFields: ({ fields, data, parentPassesCondition, path, fullData, user, locale, operation, fieldPromises, id, state, i18n, }: Args) => void;
19
+ export declare const iterateFields: ({ fields, data, parentPassesCondition, path, fullData, user, locale, operation, fieldPromises, id, state, t, }: Args) => void;
20
20
  export {};
@@ -1,6 +1,6 @@
1
1
  import { fieldIsPresentationalOnly, } from '../../../../../fields/config/types';
2
2
  import { addFieldStatePromise } from './addFieldStatePromise';
3
- export const iterateFields = ({ fields, data, parentPassesCondition, path = '', fullData, user, locale, operation, fieldPromises, id, state, i18n, }) => {
3
+ export const iterateFields = ({ fields, data, parentPassesCondition, path = '', fullData, user, locale, operation, fieldPromises, id, state, t, }) => {
4
4
  fields.forEach((field) => {
5
5
  var _a, _b;
6
6
  const initialData = data;
@@ -18,7 +18,7 @@ export const iterateFields = ({ fields, data, parentPassesCondition, path = '',
18
18
  field,
19
19
  passesCondition,
20
20
  data,
21
- i18n,
21
+ t,
22
22
  }));
23
23
  }
24
24
  });
@@ -65,7 +65,7 @@ const Form = (props) => {
65
65
  user,
66
66
  id,
67
67
  operation,
68
- i18n,
68
+ t,
69
69
  });
70
70
  }
71
71
  if (typeof validationResult === 'string') {
@@ -81,7 +81,7 @@ const Form = (props) => {
81
81
  dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState });
82
82
  }
83
83
  return isValid;
84
- }, [contextRef, id, user, operation, i18n, dispatchFields]);
84
+ }, [contextRef, id, user, operation, t, dispatchFields]);
85
85
  const submit = useCallback(async (options = {}, e) => {
86
86
  const { overrides = {}, action: actionToUse = action, method: methodToUse = method, skipValidation, } = options;
87
87
  if (disabled) {
@@ -256,10 +256,10 @@ const Form = (props) => {
256
256
  return formData;
257
257
  }, [contextRef]);
258
258
  const reset = useCallback(async (fieldSchema, data) => {
259
- const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, i18n });
259
+ const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, t });
260
260
  contextRef.current = { ...initContextState };
261
261
  dispatchFields({ type: 'REPLACE_STATE', state });
262
- }, [id, user, operation, locale, i18n, dispatchFields]);
262
+ }, [id, user, operation, locale, t, dispatchFields]);
263
263
  contextRef.current.submit = submit;
264
264
  contextRef.current.getFields = getFields;
265
265
  contextRef.current.getField = getField;
@@ -63,14 +63,14 @@ const ArrayFieldType = (props) => {
63
63
  disableFormData: (rows === null || rows === void 0 ? void 0 : rows.length) > 0,
64
64
  });
65
65
  const addRow = useCallback(async (rowIndex) => {
66
- const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale, i18n });
66
+ const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale, t });
67
67
  dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path });
68
68
  dispatchRows({ type: 'ADD', rowIndex });
69
69
  setModified(true);
70
70
  setTimeout(() => {
71
71
  scrollToID(`${path}-row-${rowIndex + 1}`);
72
72
  }, 0);
73
- }, [dispatchRows, dispatchFields, fields, path, operation, id, user, locale, setModified, i18n]);
73
+ }, [dispatchRows, dispatchFields, fields, path, operation, id, user, locale, setModified, t]);
74
74
  const duplicateRow = useCallback(async (rowIndex) => {
75
75
  dispatchFields({ type: 'DUPLICATE_ROW', rowIndex, path });
76
76
  dispatchRows({ type: 'ADD', rowIndex });
@@ -63,14 +63,14 @@ const BlocksField = (props) => {
63
63
  }, []);
64
64
  const addRow = useCallback(async (rowIndex, blockType) => {
65
65
  const block = blocks.find((potentialBlock) => potentialBlock.slug === blockType);
66
- const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user, locale, i18n });
66
+ const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user, locale, t });
67
67
  dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path, blockType });
68
68
  dispatchRows({ type: 'ADD', rowIndex, blockType });
69
69
  setModified(true);
70
70
  setTimeout(() => {
71
71
  scrollToID(`${path}-row-${rowIndex + 1}`);
72
72
  }, 0);
73
- }, [blocks, operation, id, user, locale, i18n, dispatchFields, path, setModified]);
73
+ }, [blocks, operation, id, user, locale, t, dispatchFields, path, setModified]);
74
74
  const duplicateRow = useCallback(async (rowIndex, blockType) => {
75
75
  dispatchFields({ type: 'DUPLICATE_ROW', rowIndex, path });
76
76
  dispatchRows({ type: 'ADD', rowIndex, blockType });
@@ -29,11 +29,11 @@ export const AddNewRelationModal = ({ modalCollection, onSave, modalSlug }) => {
29
29
  const modalAction = `${serverURL}${api}/${modalCollection.slug}?locale=${locale}&depth=0&fallback-locale=null`;
30
30
  useEffect(() => {
31
31
  const buildState = async () => {
32
- const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale, i18n });
32
+ const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale, t });
33
33
  setInitialState(state);
34
34
  };
35
35
  buildState();
36
- }, [modalCollection, locale, user, i18n]);
36
+ }, [modalCollection, locale, user, t]);
37
37
  useEffect(() => {
38
38
  setIsAnimated(true);
39
39
  }, []);
@@ -19,7 +19,7 @@ export const LinkButton = ({ fieldProps }) => {
19
19
  var _a, _b;
20
20
  const customFieldSchema = (_b = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.admin) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.fields;
21
21
  const modalSlug = `${baseModalSlug}-${fieldProps.path}`;
22
- const { i18n } = useTranslation();
22
+ const { t } = useTranslation();
23
23
  const config = useConfig();
24
24
  const editor = useSlate();
25
25
  const { user } = useAuth();
@@ -61,7 +61,7 @@ export const LinkButton = ({ fieldProps }) => {
61
61
  const data = {
62
62
  text: editor.selection ? Editor.string(editor, editor.selection) : '',
63
63
  };
64
- const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'create', locale, i18n });
64
+ const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'create', locale, t });
65
65
  setInitialState(state);
66
66
  }
67
67
  }
@@ -25,7 +25,7 @@ export const LinkElement = ({ attributes, children, element, editorRef, fieldPro
25
25
  const config = useConfig();
26
26
  const { user } = useAuth();
27
27
  const locale = useLocale();
28
- const { t, i18n } = useTranslation('fields');
28
+ const { t } = useTranslation('fields');
29
29
  const { openModal, toggleModal } = useModal();
30
30
  const [renderModal, setRenderModal] = useState(false);
31
31
  const [renderPopup, setRenderPopup] = useState(false);
@@ -67,11 +67,11 @@ export const LinkElement = ({ attributes, children, element, editorRef, fieldPro
67
67
  newTab: element.newTab,
68
68
  fields: deepCopyObject(element.fields),
69
69
  };
70
- const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'update', locale, i18n });
70
+ const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'update', locale, t });
71
71
  setInitialState(state);
72
72
  };
73
73
  awaitInitialState();
74
- }, [renderModal, element, fieldSchema, user, locale, i18n]);
74
+ }, [renderModal, element, fieldSchema, user, locale, t]);
75
75
  return (React.createElement("span", { className: baseClass, ...attributes },
76
76
  React.createElement("span", { style: { userSelect: 'none' }, contentEditable: false },
77
77
  renderModal && (React.createElement(EditModal, { modalSlug: modalSlug, fieldSchema: fieldSchema, close: () => {
@@ -31,11 +31,11 @@ export const EditModal = ({ slug, closeModal, relatedCollectionConfig, fieldSche
31
31
  }, [closeModal, editor, element]);
32
32
  useEffect(() => {
33
33
  const awaitInitialState = async () => {
34
- const state = await buildStateFromSchema({ fieldSchema, data: { ...(element === null || element === void 0 ? void 0 : element.fields) || {} }, user, operation: 'update', locale, i18n });
34
+ const state = await buildStateFromSchema({ fieldSchema, data: { ...(element === null || element === void 0 ? void 0 : element.fields) || {} }, user, operation: 'update', locale, t });
35
35
  setInitialState(state);
36
36
  };
37
37
  awaitInitialState();
38
- }, [fieldSchema, element.fields, user, locale, i18n]);
38
+ }, [fieldSchema, element.fields, user, locale, t]);
39
39
  return (React.createElement(Modal, { slug: slug, className: baseClass },
40
40
  React.createElement(MinimalTemplate, { width: "wide" },
41
41
  React.createElement("header", { className: `${baseClass}__header` },
@@ -15,7 +15,7 @@ const useField = (options) => {
15
15
  const operation = useOperation();
16
16
  const field = useFormFields(([fields]) => fields[path]);
17
17
  const dispatchField = useFormFields(([_, dispatch]) => dispatch);
18
- const { i18n } = useTranslation();
18
+ const { t } = useTranslation();
19
19
  const { getData, getSiblingData, setModified } = useForm();
20
20
  const value = field === null || field === void 0 ? void 0 : field.value;
21
21
  const initialValue = field === null || field === void 0 ? void 0 : field.initialValue;
@@ -77,7 +77,7 @@ const useField = (options) => {
77
77
  data: getData(),
78
78
  siblingData: getSiblingData(path),
79
79
  operation,
80
- i18n,
80
+ t,
81
81
  };
82
82
  const validationResult = typeof validate === 'function' ? await validate(value, validateOptions) : true;
83
83
  if (typeof validationResult === 'string') {
@@ -6,10 +6,13 @@ import { defaultOptions } from '../../../../translations/defaultOptions';
6
6
  import { useConfig } from '../Config';
7
7
  export const I18n = () => {
8
8
  const config = useConfig();
9
+ if (i18n.isInitialized) {
10
+ return null;
11
+ }
9
12
  i18n
10
13
  .use(LanguageDetector)
11
14
  .use(initReactI18next)
12
- .init(deepmerge(defaultOptions, config.i18n || {}));
15
+ .init(deepmerge(defaultOptions, config.i18n || { debug: true }));
13
16
  return null;
14
17
  };
15
18
  export default I18n;
@@ -25,7 +25,7 @@ const AccountView = () => {
25
25
  }, } = {}, } = {
26
26
  user: 'users',
27
27
  }, } = useConfig();
28
- const { t, i18n } = useTranslation('account');
28
+ const { t } = useTranslation('authentication');
29
29
  const collection = collections.find((coll) => coll.slug === adminUser);
30
30
  const { fields } = collection;
31
31
  const collectionPermissions = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.collections) === null || _a === void 0 ? void 0 : _a[adminUser];
@@ -36,18 +36,18 @@ const AccountView = () => {
36
36
  const action = `${serverURL}${api}/${user.collection}/${data === null || data === void 0 ? void 0 : data.id}?locale=${locale}&depth=0`;
37
37
  useEffect(() => {
38
38
  const nav = [{
39
- label: t('authentication:account'),
39
+ label: t('account'),
40
40
  }];
41
41
  setStepNav(nav);
42
42
  }, [setStepNav, t]);
43
43
  useEffect(() => {
44
44
  const awaitInitialState = async () => {
45
- const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, operation: 'update', id, user, locale, i18n });
45
+ const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, operation: 'update', id, user, locale, t });
46
46
  await getPreference(preferencesKey);
47
47
  setInitialState(state);
48
48
  };
49
49
  awaitInitialState();
50
- }, [dataToRender, fields, id, user, locale, preferencesKey, getPreference, i18n]);
50
+ }, [dataToRender, fields, id, user, locale, preferencesKey, getPreference, t]);
51
51
  return (React.createElement(RenderCustomComponent, { DefaultComponent: DefaultAccount, CustomComponent: CustomAccount, componentProps: {
52
52
  action,
53
53
  data,
@@ -20,15 +20,15 @@ const GlobalView = (props) => {
20
20
  const [initialState, setInitialState] = useState();
21
21
  const { getVersions, preferencesKey } = useDocumentInfo();
22
22
  const { getPreference } = usePreferences();
23
- const { i18n } = useTranslation();
23
+ const { t } = useTranslation();
24
24
  const { serverURL, routes: { api, }, } = useConfig();
25
25
  const { global } = props;
26
26
  const { slug, label, fields, admin: { components: { views: { Edit: CustomEdit, } = {}, } = {}, } = {}, } = global;
27
27
  const onSave = useCallback(async (json) => {
28
28
  getVersions();
29
- const state = await buildStateFromSchema({ fieldSchema: fields, data: json.result, operation: 'update', user, locale, i18n });
29
+ const state = await buildStateFromSchema({ fieldSchema: fields, data: json.result, operation: 'update', user, locale, t });
30
30
  setInitialState(state);
31
- }, [getVersions, fields, user, locale, i18n]);
31
+ }, [getVersions, fields, user, locale, t]);
32
32
  const [{ data }] = usePayloadAPI(`${serverURL}${api}/globals/${slug}`, { initialParams: { 'fallback-locale': 'null', depth: 0, draft: 'true' } });
33
33
  const dataToRender = (locationState === null || locationState === void 0 ? void 0 : locationState.data) || data;
34
34
  useEffect(() => {
@@ -39,12 +39,12 @@ const GlobalView = (props) => {
39
39
  }, [setStepNav, label]);
40
40
  useEffect(() => {
41
41
  const awaitInitialState = async () => {
42
- const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: 'update', locale, i18n });
42
+ const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: 'update', locale, t });
43
43
  await getPreference(preferencesKey);
44
44
  setInitialState(state);
45
45
  };
46
46
  awaitInitialState();
47
- }, [dataToRender, fields, user, locale, getPreference, preferencesKey, i18n]);
47
+ }, [dataToRender, fields, user, locale, getPreference, preferencesKey, t]);
48
48
  const globalPermissions = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.globals) === null || _a === void 0 ? void 0 : _a[slug];
49
49
  return (React.createElement(RenderCustomComponent, { DefaultComponent: DefaultGlobal, CustomComponent: CustomEdit, componentProps: {
50
50
  isLoading: !initialState,
@@ -12,9 +12,9 @@ const baseClass = 'api-key';
12
12
  const APIKey = () => {
13
13
  const [initialAPIKey, setInitialAPIKey] = useState(null);
14
14
  const [highlightedField, setHighlightedField] = useState(false);
15
- const { i18n } = useTranslation();
15
+ const { t } = useTranslation();
16
16
  const apiKey = useFormFields(([fields]) => fields[path]);
17
- const validate = (val) => text(val, { minLength: 24, maxLength: 48, data: {}, siblingData: {}, i18n });
17
+ const validate = (val) => text(val, { minLength: 24, maxLength: 48, data: {}, siblingData: {}, t });
18
18
  const apiKeyValue = apiKey === null || apiKey === void 0 ? void 0 : apiKey.value;
19
19
  const APIKeyLabel = useMemo(() => (React.createElement("div", { className: `${baseClass}__label` },
20
20
  React.createElement("span", null, "API Key"),
@@ -26,13 +26,14 @@ import SaveDraft from '../../../elements/SaveDraft';
26
26
  import { useDocumentInfo } from '../../../utilities/DocumentInfo';
27
27
  import { OperationContext } from '../../../utilities/OperationProvider';
28
28
  import { Gutter } from '../../../elements/Gutter';
29
+ import { getTranslation } from '../../../../../utilities/getTranslation';
29
30
  import './index.scss';
30
31
  const baseClass = 'collection-edit';
31
32
  const DefaultEditView = (props) => {
32
33
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
33
34
  const { admin: { dateFormat }, routes: { admin } } = useConfig();
34
35
  const { publishedDoc } = useDocumentInfo();
35
- const { t } = useTranslation('general');
36
+ const { t, i18n } = useTranslation('general');
36
37
  const { collection, isEditing, data, onSave, permissions, isLoading, initialState, apiURL, action, hasSavePermission, disableEyebrow, disableActions, disableLeaveWithoutSaving, customHeader, id, } = props;
37
38
  const { slug, fields, admin: { useAsTitle, disableDuplicate, preview, hideAPIURL, }, versions, timestamps, auth, upload, } = collection;
38
39
  const classes = [
@@ -45,7 +46,7 @@ const DefaultEditView = (props) => {
45
46
  !isLoading && (React.createElement(OperationContext.Provider, { value: operation },
46
47
  React.createElement(Form, { className: `${baseClass}__form`, method: id ? 'patch' : 'post', action: action, onSuccess: onSave, disabled: !hasSavePermission, initialState: initialState },
47
48
  React.createElement("div", { className: `${baseClass}__main` },
48
- React.createElement(Meta, { title: `${isEditing ? t('editing') : t('creating')} - ${collection.labels.singular}`, description: `${isEditing ? t('editing') : t('creating')} - ${collection.labels.singular}`, keywords: `${collection.labels.singular}, Payload, CMS` }),
49
+ React.createElement(Meta, { title: `${isEditing ? t('editing') : t('creating')} - ${getTranslation(collection.labels.singular, i18n)}`, description: `${isEditing ? t('editing') : t('creating')} - ${getTranslation(collection.labels.singular, i18n)}`, keywords: `${getTranslation(collection.labels.singular, i18n)}, Payload, CMS` }),
49
50
  !disableEyebrow && (React.createElement(Eyebrow, null)),
50
51
  (!(((_a = collection.versions) === null || _a === void 0 ? void 0 : _a.drafts) && ((_c = (_b = collection.versions) === null || _b === void 0 ? void 0 : _b.drafts) === null || _c === void 0 ? void 0 : _c.autosave)) && !disableLeaveWithoutSaving) && (React.createElement(LeaveWithoutSaving, null)),
51
52
  React.createElement(Gutter, { className: `${baseClass}__edit` },
@@ -39,10 +39,10 @@ const EditView = (props) => {
39
39
  setRedirect(`${admin}/collections/${collection.slug}/${(_a = json === null || json === void 0 ? void 0 : json.doc) === null || _a === void 0 ? void 0 : _a.id}`);
40
40
  }
41
41
  else {
42
- const state = await buildStateFromSchema({ fieldSchema: collection.fields, data: json.doc, user, id, operation: 'update', locale, i18n });
42
+ const state = await buildStateFromSchema({ fieldSchema: collection.fields, data: json.doc, user, id, operation: 'update', locale, t });
43
43
  setInitialState(state);
44
44
  }
45
- }, [admin, collection, isEditing, getVersions, user, id, i18n, locale]);
45
+ }, [admin, collection, isEditing, getVersions, user, id, t, locale]);
46
46
  const [{ data, isLoading: isLoadingDocument, isError }] = usePayloadAPI((isEditing ? `${serverURL}${api}/${slug}/${id}` : null), { initialParams: { 'fallback-locale': 'null', depth: 0, draft: 'true' } });
47
47
  const dataToRender = (locationState === null || locationState === void 0 ? void 0 : locationState.data) || data;
48
48
  useEffect(() => {
@@ -81,12 +81,12 @@ const EditView = (props) => {
81
81
  return;
82
82
  }
83
83
  const awaitInitialState = async () => {
84
- const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: isEditing ? 'update' : 'create', id, locale, i18n });
84
+ const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: isEditing ? 'update' : 'create', id, locale, t });
85
85
  await getPreference(preferencesKey);
86
86
  setInitialState(state);
87
87
  };
88
88
  awaitInitialState();
89
- }, [dataToRender, fields, isEditing, id, user, locale, isLoadingDocument, preferencesKey, getPreference, i18n]);
89
+ }, [dataToRender, fields, isEditing, id, user, locale, isLoadingDocument, preferencesKey, getPreference, t]);
90
90
  useEffect(() => {
91
91
  if (redirect) {
92
92
  history.push(redirect);