3.9.11.14. 获取本地化消息

REST API 中有一些方法可以获取实体,及其属性和枚举的本地化消息。

例如,要获取 sec$User 实体的本地化消息列表,必须执行以下 GET 请求:

http://localhost:8080/app/rest/v2/messages/entities/sec$User

必须将 OAuth 令牌放在带有 Bearer 类型的 Authorization 请求头中。

可以使用 Accept-Language http 请求头显式指定所需的区域设置。

响应如下:

  1. {
  2. "sec$User": "User",
  3. "sec$User.active": "Active",
  4. "sec$User.changePasswordAtNextLogon": "Change Password at Next Logon",
  5. "sec$User.createTs": "Created At",
  6. "sec$User.createdBy": "Created By",
  7. "sec$User.deleteTs": "Deleted At",
  8. "sec$User.deletedBy": "Deleted By",
  9. "sec$User.email": "Email",
  10. "sec$User.firstName": "First Name",
  11. "sec$User.group": "Group",
  12. "sec$User.id": "ID",
  13. "sec$User.ipMask": "Permitted IP Mask",
  14. "sec$User.language": "Language",
  15. "sec$User.lastName": "Last Name",
  16. "sec$User.login": "Login",
  17. "sec$User.loginLowerCase": "Login",
  18. "sec$User.middleName": "Middle Name",
  19. "sec$User.name": "Name",
  20. "sec$User.password": "Password",
  21. "sec$User.position": "Position",
  22. "sec$User.substitutions": "Substitutions",
  23. "sec$User.timeZone": "Time Zone",
  24. "sec$User.timeZoneAuto": "Autodetect Time Zone",
  25. "sec$User.updateTs": "Updated At",
  26. "sec$User.updatedBy": "Updated By",
  27. "sec$User.userRoles": "User Roles",
  28. "sec$User.version": "Version"
  29. }

要获取枚举的本地化值,请使用以下 URL:

http://localhost:8080/app/rest/v2/messages/enums/com.haulmont.cuba.security.entity.RoleType

如果省略 URL 中的实体名称或枚举名称部分,将获得所有实体或枚举的本地化值。