翻译者: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属性相关联。

限制条件

  1. 请注意,这里描述的实现并不适用于注释中的嵌入文本体,因为注释使用价值和语言的网络注释模式作为单独的属性。
  2. 应该注意的是,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中查看

  1. {
  2. "@context": "http://iiif.io/api/presentation/3/context.json",
  3. "id": "https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json",
  4. "type": "Manifest",
  5. "label": {
  6. "en": [
  7. "Whistler's Mother"
  8. ],
  9. "fr": [
  10. "La Mère de Whistler"
  11. ]
  12. },
  13. "metadata": [
  14. {
  15. "label": {
  16. "en": [
  17. "Creator"
  18. ],
  19. "fr": [
  20. "Auteur"
  21. ]
  22. },
  23. "value": {
  24. "none": [
  25. "Whistler, James Abbott McNeill"
  26. ]
  27. }
  28. },
  29. {
  30. "label": {
  31. "en": [
  32. "Subject"
  33. ],
  34. "fr": [
  35. "Sujet"
  36. ]
  37. },
  38. "value": {
  39. "en": [
  40. "McNeill Anna Matilda, mother of Whistler (1804-1881)"
  41. ],
  42. "fr": [
  43. "McNeill Anna Matilda, mère de Whistler (1804-1881)"
  44. ]
  45. }
  46. }
  47. ],
  48. "summary": {
  49. "en": [
  50. "Arrangement in Grey and Black No. 1, also called Portrait of the Artist's Mother."
  51. ],
  52. "fr": [
  53. "Arrangement en gris et noir n°1, also called Portrait de la mère de l'artiste."
  54. ]
  55. },
  56. "requiredStatement": {
  57. "label": {
  58. "en": [
  59. "Held By"
  60. ],
  61. "fr": [
  62. "Détenu par"
  63. ]
  64. },
  65. "value": {
  66. "none": [
  67. "Musée d'Orsay, Paris, France"
  68. ]
  69. }
  70. },
  71. "items": [
  72. {
  73. "id": "https://iiif.io/api/cookbook/recipe/0006-text-language/canvas/p1",
  74. "type": "Canvas",
  75. "width": 1114,
  76. "height": 991,
  77. "items": [
  78. {
  79. "id": "https://iiif.io/api/cookbook/recipe/0006-text-language/page/p1/1",
  80. "type": "AnnotationPage",
  81. "items": [
  82. {
  83. "id": "https://iiif.io/api/cookbook/recipe/0006-text-language/annotation/p0001-image",
  84. "type": "Annotation",
  85. "motivation": "painting",
  86. "body": {
  87. "id": "https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother/full/max/0/default.jpg",
  88. "type": "Image",
  89. "format": "image/jpeg",
  90. "width": 1114,
  91. "height": 991,
  92. "service": [
  93. {
  94. "id": "https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother",
  95. "profile": "level1",
  96. "type": "ImageService3"
  97. }
  98. ]
  99. },
  100. "target": "https://iiif.io/api/cookbook/recipe/0006-text-language/canvas/p1"
  101. }
  102. ]
  103. }
  104. ]
  105. }
  106. ]
  107. }

相关专题