翻译者:syl
原文链接:https://iiif.io/api/cookbook/recipe/0006-text-language/
用例
在某些情况下,一个IIIF资源可能有一种以上的语言的标题或描述(标签或摘要);或者,内容的发布者可能希望为不同语言的受众提供多种语言的描述性元数据字段标签,例如,为创作者字段提供英语和法语的标签(”Creator”、”Auteur”)。
实施说明
在IIIF呈现API 3.0中,对于打算显示给用户的字符串,语言地图是强制性的。语言使用JSON键/值对来指定,其中指定的语言是遵循BCP 47语言代码的键,值是一个数组,例如。”en”:[“Whistler’s Monther”]。如果语言不知道或者字符串没有语言,那么键必须是字符串none。
客户端将按照IIIF呈现API 3.0规范中的属性值语言部分提供的处理规则来选择适当的值。
语言键应该与清单label和summary属性,以及metadate和requiredStatement描述性属性的label和vlaue属性相关联。
限制条件
- 请注意,这里描述的实现并不适用于注释中的嵌入文本体,因为注释使用价值和语言的网络注释模式作为单独的属性。
- 应该注意的是,BCP 47允许连字符断句,以表示地区和脚本(例如en-US);但是,如果你用Javascript处理这些清单,就会破坏用于导航JSON对象的.符号功能,因此建议用括号来访问语言属性。
例子
在这个例子中,内容是一幅由James Abbott McNeill Whistler创作的通常被称为Whistler’s Mother的画作的图像。清单label属性同时具有英文和法文标题(第6-11行)。
在metadata和requiredStatement属性中,”Creator”、”Subject “和 “Held by “字段(第16-21、31-36、58-63行)的label字符串都是用英语和法语提供。主题 “字段的值(第39-44行)以英语和法语提供,而 “创造者 “和 “持有者 “字段的值(第24-26行,第66-68行)没有指定语言,因此在语言地图中使用 “none”。
最后,summary属性(第49-54行)有英文和法文的数值。
要在链接的查看器中看到语言选择,打开设置菜单(齿轮图标),选择英语或法语。
本例中的图片是通过维基共享资源获得的,属于公共领域。
JSON-LD|在Universal Viewer中查看|在Mirador中查看
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json",
"type": "Manifest",
"label": {
"en": [
"Whistler's Mother"
],
"fr": [
"La Mère de Whistler"
]
},
"metadata": [
{
"label": {
"en": [
"Creator"
],
"fr": [
"Auteur"
]
},
"value": {
"none": [
"Whistler, James Abbott McNeill"
]
}
},
{
"label": {
"en": [
"Subject"
],
"fr": [
"Sujet"
]
},
"value": {
"en": [
"McNeill Anna Matilda, mother of Whistler (1804-1881)"
],
"fr": [
"McNeill Anna Matilda, mère de Whistler (1804-1881)"
]
}
}
],
"summary": {
"en": [
"Arrangement in Grey and Black No. 1, also called Portrait of the Artist's Mother."
],
"fr": [
"Arrangement en gris et noir n°1, also called Portrait de la mère de l'artiste."
]
},
"requiredStatement": {
"label": {
"en": [
"Held By"
],
"fr": [
"Détenu par"
]
},
"value": {
"none": [
"Musée d'Orsay, Paris, France"
]
}
},
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0006-text-language/canvas/p1",
"type": "Canvas",
"width": 1114,
"height": 991,
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0006-text-language/page/p1/1",
"type": "AnnotationPage",
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0006-text-language/annotation/p0001-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother/full/max/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"width": 1114,
"height": 991,
"service": [
{
"id": "https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother",
"profile": "level1",
"type": "ImageService3"
}
]
},
"target": "https://iiif.io/api/cookbook/recipe/0006-text-language/canvas/p1"
}
]
}
]
}
]
}