Interface

TranslateFunctions

TranslateFunctions

Translate Functions are the helper functions which you can use to translate your application.

On the fronted they can be used with useTranslation hook. On the backend they are injected to any AdminJS instance and ActionContext.

View Source adminjs/src/utils/translate-functions.factory.ts, line 48

Members

TranslateFunction

# translateAction

Translates all actions, to be more specific - their labels. By default, it looks for a translation key in resource.{resourceId}.actions.{actionName}, when it doesn't find that, the lookup is moved to actions.{actionName}. Finally, when that also fails, it returns startCase of the action name.

View Source adminjs/src/utils/translate-functions.factory.ts, line 73

TranslateFunction

# translateButton

Translates all buttons. By default, it looks for a translation key in resource.{resourceId}.buttons.{actionName}, when it doesn't find that, the lookup is moved to buttons.{actionName}. Finally, when that also fails, it returns startCase of the given button name.

View Source adminjs/src/utils/translate-functions.factory.ts, line 87

TranslateFunction

# translateLabel

Translates all labels. Most of all all resource names are treated as labels. Also, labels are texts in the user interface which cannot be recognized as any other type. By default, it looks for a translation key in resource.{resourceId}.labels.{actionName}, when it doesn't find that, the lookup is moved to labels.{actionName}. Finally, when that also fails, it returns startCase of the given label.

View Source adminjs/src/utils/translate-functions.factory.ts, line 101

TranslateFunction

# translateMessage

Translates all the messages in the application. By default, it looks for a translation key in resource.{resourceId}.messages.{messageName}, when it doesn't find that, the lookup is moved to messages.{messageName}. Finally, when that also fails, it returns startCase of the given message name.

View Source adminjs/src/utils/translate-functions.factory.ts, line 143

TranslateFunction

# translateProperty

Translates all the property names. By default, it looks for a translation key in resource.{resourceId}.properties.{propertyPath}, when it doesn't find that, the lookup is moved to properties.{propertyPath}. When that fails, it returns startCase of the given property name.

What is important here is that you can put nested property as well, In that case you have to pass dotted path:

{
  properties: {
     parent: 'parent property',
     'parent.nested': 'nested property'
  }
}

View Source adminjs/src/utils/translate-functions.factory.ts, line 117

Type Definitions

# TranslateFunction(key, resourceIdopt, optionsopt)

Parameters:
Name Type Attributes Description
key string

kwy which should be translated in a given namespace

resourceId string | TOptions <optional>

Optional resourceId or Translate options

options TOptions <optional>

Translate options

View Source adminjs/src/utils/translate-functions.factory.ts, line 40