5.14. 获取本地化消息
REST API 中有一些方法可以获取实体,实体属性和枚举的本地化消息。
例如,要获取 sec$User
实体的本地化消息列表,必须执行以下 GET 请求:
http://localhost:8080/app/rest/v2/messages/entities/sec$User
必须将 OAuth token 放在带有 Bearer
类型的 Authorization
请求头中。
可以使用 Accept-Language http 请求头显式指定所需的区域设置。
响应如下:
{
"sec$User": "User",
"sec$User.active": "Active",
"sec$User.changePasswordAtNextLogon": "Change Password at Next Logon",
"sec$User.createTs": "Created At",
"sec$User.createdBy": "Created By",
"sec$User.deleteTs": "Deleted At",
"sec$User.deletedBy": "Deleted By",
"sec$User.email": "Email",
"sec$User.firstName": "First Name",
"sec$User.group": "Group",
"sec$User.id": "ID",
"sec$User.ipMask": "Permitted IP Mask",
"sec$User.language": "Language",
"sec$User.lastName": "Last Name",
"sec$User.login": "Login",
"sec$User.loginLowerCase": "Login",
"sec$User.middleName": "Middle Name",
"sec$User.name": "Name",
"sec$User.password": "Password",
"sec$User.position": "Position",
"sec$User.substitutions": "Substitutions",
"sec$User.timeZone": "Time Zone",
"sec$User.timeZoneAuto": "Autodetect Time Zone",
"sec$User.updateTs": "Updated At",
"sec$User.updatedBy": "Updated By",
"sec$User.userRoles": "User Roles",
"sec$User.version": "Version"
}
要获取枚举的本地化值,请使用以下 URL:
http://localhost:8080/app/rest/v2/messages/enums/com.haulmont.cuba.security.entity.RoleType
如果省略 URL 中的实体名称或枚举名称部分,将获得所有实体或枚举的本地化值。