docs: translation module (#14271)
* docs: translation module * fix link in JS SDK * add translations user guides [WIP] * updates * fix broken link * remove mentions of default locale * change header * updates * updated user guides * handle todos * fix build error * fix lint errors
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
453
www/utils/generated/typedoc-json-output/translation-models.json
Normal file
453
www/utils/generated/typedoc-json-output/translation-models.json
Normal file
@@ -0,0 +1,453 @@
|
||||
{
|
||||
"id": 391,
|
||||
"name": "translation-models",
|
||||
"variant": "project",
|
||||
"kind": 1,
|
||||
"flags": {},
|
||||
"children": [
|
||||
{
|
||||
"id": 399,
|
||||
"name": "Locale",
|
||||
"variant": "declaration",
|
||||
"kind": 32,
|
||||
"flags": {
|
||||
"isConst": true
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "locale.ts",
|
||||
"line": 3,
|
||||
"character": 6,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/locale.ts#L3"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/entity.ts",
|
||||
"qualifiedName": "DmlEntity"
|
||||
},
|
||||
"typeArguments": [
|
||||
{
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/entity.ts",
|
||||
"qualifiedName": "DMLEntitySchemaBuilder"
|
||||
},
|
||||
"typeArguments": [
|
||||
{
|
||||
"type": "reflection",
|
||||
"declaration": {
|
||||
"id": 400,
|
||||
"name": "__type",
|
||||
"variant": "declaration",
|
||||
"kind": 65536,
|
||||
"flags": {},
|
||||
"children": [
|
||||
{
|
||||
"id": 401,
|
||||
"name": "id",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "locale.ts",
|
||||
"line": 5,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/locale.ts#L5"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/primary-key.ts",
|
||||
"qualifiedName": "PrimaryKeyModifier"
|
||||
},
|
||||
"typeArguments": [
|
||||
{
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/id.ts",
|
||||
"qualifiedName": "IdProperty"
|
||||
},
|
||||
"name": "IdProperty",
|
||||
"package": "@medusajs/utils"
|
||||
}
|
||||
],
|
||||
"name": "PrimaryKeyModifier",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 402,
|
||||
"name": "code",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "locale.ts",
|
||||
"line": 6,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/locale.ts#L6"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/text.ts",
|
||||
"qualifiedName": "TextProperty"
|
||||
},
|
||||
"name": "TextProperty",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 403,
|
||||
"name": "name",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "locale.ts",
|
||||
"line": 7,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/locale.ts#L7"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/text.ts",
|
||||
"qualifiedName": "TextProperty"
|
||||
},
|
||||
"name": "TextProperty",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"title": "Properties",
|
||||
"children": [
|
||||
401,
|
||||
402,
|
||||
403
|
||||
]
|
||||
}
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "locale.ts",
|
||||
"line": 4,
|
||||
"character": 20,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/locale.ts#L4"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "DMLEntitySchemaBuilder",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
{
|
||||
"type": "literal",
|
||||
"value": "locale"
|
||||
}
|
||||
],
|
||||
"name": "DmlEntity",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 392,
|
||||
"name": "Translation",
|
||||
"variant": "declaration",
|
||||
"kind": 32,
|
||||
"flags": {
|
||||
"isConst": true
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 3,
|
||||
"character": 6,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L3"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/entity.ts",
|
||||
"qualifiedName": "DmlEntity"
|
||||
},
|
||||
"typeArguments": [
|
||||
{
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/entity.ts",
|
||||
"qualifiedName": "DMLEntitySchemaBuilder"
|
||||
},
|
||||
"typeArguments": [
|
||||
{
|
||||
"type": "reflection",
|
||||
"declaration": {
|
||||
"id": 393,
|
||||
"name": "__type",
|
||||
"variant": "declaration",
|
||||
"kind": 65536,
|
||||
"flags": {},
|
||||
"children": [
|
||||
{
|
||||
"id": 394,
|
||||
"name": "id",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 5,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L5"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/primary-key.ts",
|
||||
"qualifiedName": "PrimaryKeyModifier"
|
||||
},
|
||||
"typeArguments": [
|
||||
{
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/id.ts",
|
||||
"qualifiedName": "IdProperty"
|
||||
},
|
||||
"name": "IdProperty",
|
||||
"package": "@medusajs/utils"
|
||||
}
|
||||
],
|
||||
"name": "PrimaryKeyModifier",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 395,
|
||||
"name": "reference_id",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 6,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L6"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/text.ts",
|
||||
"qualifiedName": "TextProperty"
|
||||
},
|
||||
"name": "TextProperty",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 396,
|
||||
"name": "reference",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 7,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L7"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/text.ts",
|
||||
"qualifiedName": "TextProperty"
|
||||
},
|
||||
"name": "TextProperty",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 397,
|
||||
"name": "locale_code",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 8,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L8"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/text.ts",
|
||||
"qualifiedName": "TextProperty"
|
||||
},
|
||||
"name": "TextProperty",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
},
|
||||
{
|
||||
"id": 398,
|
||||
"name": "translations",
|
||||
"variant": "declaration",
|
||||
"kind": 1024,
|
||||
"flags": {},
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 9,
|
||||
"character": 4,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L9"
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"type": "reference",
|
||||
"target": {
|
||||
"sourceFileName": "../../../../packages/core/utils/src/dml/properties/json.ts",
|
||||
"qualifiedName": "JSONProperty"
|
||||
},
|
||||
"name": "JSONProperty",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"title": "Properties",
|
||||
"children": [
|
||||
394,
|
||||
395,
|
||||
396,
|
||||
397,
|
||||
398
|
||||
]
|
||||
}
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"fileName": "translation.ts",
|
||||
"line": 4,
|
||||
"character": 25,
|
||||
"url": "https://github.com/medusajs/medusa/blob/8bd1d22765edef3b3d2ff31c8f8935049d8b280a/packages/modules/translation/src/models/translation.ts#L4"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "DMLEntitySchemaBuilder",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
{
|
||||
"type": "literal",
|
||||
"value": "translation"
|
||||
}
|
||||
],
|
||||
"name": "DmlEntity",
|
||||
"package": "@medusajs/utils"
|
||||
},
|
||||
"defaultValue": "..."
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"title": "Variables",
|
||||
"children": [
|
||||
399,
|
||||
392
|
||||
]
|
||||
}
|
||||
],
|
||||
"packageName": "@medusajs/translation",
|
||||
"symbolIdMap": {
|
||||
"391": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/index.ts",
|
||||
"qualifiedName": ""
|
||||
},
|
||||
"392": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "Translation"
|
||||
},
|
||||
"393": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "__object"
|
||||
},
|
||||
"394": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "__object.id"
|
||||
},
|
||||
"395": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "__object.reference_id"
|
||||
},
|
||||
"396": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "__object.reference"
|
||||
},
|
||||
"397": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "__object.locale_code"
|
||||
},
|
||||
"398": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/translation.ts",
|
||||
"qualifiedName": "__object.translations"
|
||||
},
|
||||
"399": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/locale.ts",
|
||||
"qualifiedName": "Locale"
|
||||
},
|
||||
"400": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/locale.ts",
|
||||
"qualifiedName": "__object"
|
||||
},
|
||||
"401": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/locale.ts",
|
||||
"qualifiedName": "__object.id"
|
||||
},
|
||||
"402": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/locale.ts",
|
||||
"qualifiedName": "__object.code"
|
||||
},
|
||||
"403": {
|
||||
"sourceFileName": "../../../../packages/modules/translation/src/models/locale.ts",
|
||||
"qualifiedName": "__object.name"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"entries": {
|
||||
"1": "../../../../packages/modules/translation/src/models/index.ts"
|
||||
},
|
||||
"reflections": {
|
||||
"1": 391
|
||||
}
|
||||
}
|
||||
}
|
||||
13200
www/utils/generated/typedoc-json-output/translation.json
Normal file
13200
www/utils/generated/typedoc-json-output/translation.json
Normal file
File diff suppressed because it is too large
Load Diff
11
www/utils/packages/typedoc-config/translation.json
Normal file
11
www/utils/packages/typedoc-config/translation.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/tsconfig",
|
||||
"extends": [
|
||||
"../../../../packages/modules/translation/tsconfig.json"
|
||||
],
|
||||
"include": ["../../../../packages/modules/translation/src"],
|
||||
"exclude": [
|
||||
"../../../../packages/modules/translation/dist",
|
||||
"../../../../packages/modules/translation/node_modules"
|
||||
]
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { modules } from "./references.js"
|
||||
import {
|
||||
customModuleServiceNames,
|
||||
customModuleTitles,
|
||||
dmlModules,
|
||||
} from "./references-details.js"
|
||||
import { AllowedProjectDocumentsOption, FormattingOptionsType } from "types"
|
||||
import { kebabToCamel, kebabToPascal, kebabToSnake, kebabToTitle } from "utils"
|
||||
@@ -39,9 +38,6 @@ modules.forEach((module) => {
|
||||
allowedProjectDocuments[module] = {
|
||||
...commonAllowedDocuments,
|
||||
}
|
||||
})
|
||||
|
||||
dmlModules.forEach((module) => {
|
||||
allowedProjectDocuments[`${module}-models`] = {
|
||||
...commonAllowedDocuments,
|
||||
}
|
||||
@@ -104,7 +100,6 @@ const mergerOptions: Partial<TypeDocOptions> = {
|
||||
)
|
||||
? customModuleServiceNames[moduleName]
|
||||
: `I${kebabToPascal(moduleName)}ModuleService`
|
||||
const isDmlModule = dmlModules.includes(moduleName)
|
||||
|
||||
const customModuleConfig: FormattingOptionsType = {}
|
||||
|
||||
@@ -175,23 +170,15 @@ You should only use the methods in this reference when implementing complex cust
|
||||
slug: `/references/${moduleName}/models/{{alias}}`,
|
||||
sidebar_label: "{{alias}}",
|
||||
},
|
||||
reflectionDescription: !isDmlModule
|
||||
? `This documentation provides a reference to the {{alias}} {{kind}}. This belongs to the ${titleModuleName} Module.`
|
||||
: `This documentation provides a reference to the {{alias}} data model. It belongs to the ${titleModuleName} Module.`,
|
||||
reflectionDescription: `This documentation provides a reference to the {{alias}} data model. It belongs to the ${titleModuleName} Module.`,
|
||||
reflectionTitle: {
|
||||
kind: false,
|
||||
typeParameters: false,
|
||||
suffix: `- ${titleModuleName} Module Data Models Reference`,
|
||||
},
|
||||
reflectionGroups: isDmlModule
|
||||
? {
|
||||
Variables: true,
|
||||
}
|
||||
: {
|
||||
Constructors: false,
|
||||
Functions: false,
|
||||
Methods: false,
|
||||
},
|
||||
reflectionGroups: {
|
||||
Variables: true,
|
||||
},
|
||||
internalType: "model-ref",
|
||||
},
|
||||
[`^modules/${snakeCaseModuleName}_models`]: {
|
||||
@@ -203,11 +190,9 @@ You should only use the methods in this reference when implementing complex cust
|
||||
reflectionTitle: {
|
||||
fullReplacement: `${titleModuleName} Module Data Models Reference`,
|
||||
},
|
||||
reflectionGroupRename: isDmlModule
|
||||
? {
|
||||
Variables: "Data Models",
|
||||
}
|
||||
: {},
|
||||
reflectionGroupRename: {
|
||||
Variables: "Data Models",
|
||||
},
|
||||
internalType: "model-ref",
|
||||
},
|
||||
} as FormattingOptionsType)
|
||||
|
||||
@@ -33,25 +33,3 @@ export const customModulesOptions: Record<string, Partial<TypeDocOptions>> = {
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
// a list of modules that now support DML
|
||||
export const dmlModules = [
|
||||
"currency",
|
||||
"region",
|
||||
"product",
|
||||
"user",
|
||||
"auth",
|
||||
"pricing",
|
||||
"cart",
|
||||
"sales-channel",
|
||||
"api-key",
|
||||
"store",
|
||||
"customer",
|
||||
"inventory-next",
|
||||
"payment",
|
||||
"promotion",
|
||||
"stock-location-next",
|
||||
"tax",
|
||||
"fulfillment",
|
||||
"order",
|
||||
]
|
||||
|
||||
@@ -16,6 +16,7 @@ export const modules = [
|
||||
"stock-location-next",
|
||||
"store",
|
||||
"tax",
|
||||
"translation",
|
||||
"user",
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user