Saltearse al contenido

Locale

Esta página aún no está disponible en tu idioma.

locale allows setting Locale-specific settings

studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
plugins?: StudioCMSPlugin[] | undefined;
logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined;
dbStartPage?: boolean | undefined;
verbose?: boolean | undefined;
componentRegistry?: Record<string, string> | undefined;
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined;
features?: {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
robotsTXT?: boolean | RobotsConfig | undefined;
injectQuickActionsMenu?: boolean | undefined;
dashboardConfig?: {
dashboardEnabled?: boolean | undefined;
inject404Route?: boolean | undefined;
faviconURL?: string | undefined;
dashboardRouteOverride?: string | undefined;
versionCheck?: boolean | undefined;
} | undefined;
authConfig?: {
providers?: {
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined;
enabled?: boolean | undefined;
} | undefined;
developerConfig?: {
demoMode?: false | {
password: string;
username: string;
} | undefined;
} | undefined;
preferredImageService?: string ...

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms';
export default defineStudioCMSConfig({
dbStartPage: true,
contentRenderer: 'marked',
verbose: true,
dateLocale: 'en-us',
// ...Other Options
})

defineStudioCMSConfig
({
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined
locale
: {
dateLocale?: string | undefined
dateLocale
: 'en-US',
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined
dateTimeFormat
: {}
},
});

dateLocale is a BCP 47 locale identifier used for date formatting.

  • Type: string
  • Default: 'en-US'
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
plugins?: StudioCMSPlugin[] | undefined;
logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined;
dbStartPage?: boolean | undefined;
verbose?: boolean | undefined;
componentRegistry?: Record<string, string> | undefined;
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined;
features?: {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
robotsTXT?: boolean | RobotsConfig | undefined;
injectQuickActionsMenu?: boolean | undefined;
dashboardConfig?: {
dashboardEnabled?: boolean | undefined;
inject404Route?: boolean | undefined;
faviconURL?: string | undefined;
dashboardRouteOverride?: string | undefined;
versionCheck?: boolean | undefined;
} | undefined;
authConfig?: {
providers?: {
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined;
enabled?: boolean | undefined;
} | undefined;
developerConfig?: {
demoMode?: false | {
password: string;
username: string;
} | undefined;
} | undefined;
preferredImageService?: string ...

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms';
export default defineStudioCMSConfig({
dbStartPage: true,
contentRenderer: 'marked',
verbose: true,
dateLocale: 'en-us',
// ...Other Options
})

defineStudioCMSConfig
({
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined
locale
: {
dateLocale?: string | undefined
dateLocale
: 'en-US', // DEFAULT - This sets the date locale for date formatting.
}
})

dateTimeFormat is an object that is used to configure the date time format.

  • Type: Intl.DateTimeFormatOptions
  • Default: {}
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): {
plugins?: StudioCMSPlugin[] | undefined;
logLevel?: "All" | "Fatal" | "Error" | "Warning" | "Info" | "Debug" | "Trace" | "None" | undefined;
dbStartPage?: boolean | undefined;
verbose?: boolean | undefined;
componentRegistry?: Record<string, string> | undefined;
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined;
features?: {
sdk?: boolean | {
cacheConfig?: boolean | {
lifetime?: string | undefined;
} | undefined;
} | undefined;
robotsTXT?: boolean | RobotsConfig | undefined;
injectQuickActionsMenu?: boolean | undefined;
dashboardConfig?: {
dashboardEnabled?: boolean | undefined;
inject404Route?: boolean | undefined;
faviconURL?: string | undefined;
dashboardRouteOverride?: string | undefined;
versionCheck?: boolean | undefined;
} | undefined;
authConfig?: {
providers?: {
usernameAndPassword?: boolean | undefined;
usernameAndPasswordConfig?: {
allowUserRegistration?: boolean | undefined;
} | undefined;
} | undefined;
enabled?: boolean | undefined;
} | undefined;
developerConfig?: {
demoMode?: false | {
password: string;
username: string;
} | undefined;
} | undefined;
preferredImageService?: string ...

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms';
export default defineStudioCMSConfig({
dbStartPage: true,
contentRenderer: 'marked',
verbose: true,
dateLocale: 'en-us',
// ...Other Options
})

defineStudioCMSConfig
({
locale?: {
dateLocale?: string | undefined;
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined;
} | undefined
locale
: {
dateTimeFormat?: Intl.DateTimeFormatOptions | undefined
dateTimeFormat
: {
Intl.DateTimeFormatOptions.year?: "numeric" | "2-digit" | undefined
year
: "numeric",
Intl.DateTimeFormatOptions.month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined
month
: "short",
Intl.DateTimeFormatOptions.day?: "numeric" | "2-digit" | undefined
day
: "numeric"
},
}
})