Skip to content

Locale

locale allows setting Locale-specific settings

studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

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/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
({
StudioCMSOptions.locale?: LocaleConfig

Locale specific settings

locale
: {
LocaleConfig.dateLocale?: string

Date Locale used for formatting dates

@default'en-us'

dateLocale
: 'en-US',
LocaleConfig.dateTimeFormat?: Intl.DateTimeFormatOptions

DateTime Format Options

@default{ year: 'numeric', month: 'short', day: 'numeric' }

dateTimeFormat
: {},
LocaleConfig.i18n?: {
defaultLocale?: string;
}

I18n Specific Settings

i18n
: {}
},
});

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): StudioCMSOptions

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/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
({
StudioCMSOptions.locale?: LocaleConfig

Locale specific settings

locale
: {
LocaleConfig.dateLocale?: string

Date Locale used for formatting dates

@default'en-us'

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): StudioCMSOptions

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/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
({
StudioCMSOptions.locale?: LocaleConfig

Locale specific settings

locale
: {
LocaleConfig.dateTimeFormat?: Intl.DateTimeFormatOptions

DateTime Format Options

@default{ year: 'numeric', month: 'short', day: 'numeric' }

dateTimeFormat
: {
Intl.DateTimeFormatOptions.year?: "numeric" | "2-digit" | undefined
year
: "numeric",
Intl.DateTimeFormatOptions.month?: "numeric" | "2-digit" | "short" | "long" | "narrow" | undefined
month
: "short",
Intl.DateTimeFormatOptions.day?: "numeric" | "2-digit" | undefined
day
: "numeric"
},
}
})

i18n is an object that is used to configure internationalization options.

  • Type: object
  • Default: {}
studiocms.config.mjs
export default
function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

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/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
({
StudioCMSOptions.locale?: LocaleConfig

Locale specific settings

locale
: {
LocaleConfig.i18n?: {
defaultLocale?: string;
}

I18n Specific Settings

i18n
: {
defaultLocale?: string

Default Locale for the StudioCMS

This option sets the default language for the StudioCMS application.

It must be one of the available translation keys or 'en' for English.

@default'en'

defaultLocale
: 'en',
},
}
})