@@ -451,21 +451,6 @@ <h3>
451
451
< a > manifest</ a > . The [=manifest/dir=] member's value can be set to a
452
452
< a > text-direction</ a > .
453
453
</ p >
454
- < p >
455
- The < dfn > localizable members</ dfn > are:
456
- </ p >
457
- < ul >
458
- < li > [=manifest/name=] member.
459
- </ li >
460
- < li > [=manifest/short_name=] member.
461
- </ li >
462
- < li > [=Shortcut item's=] [=shortcut item/name=] member.
463
- </ li >
464
- < li > [=Shortcut item's=] [=shortcut item/short_name=] member.
465
- </ li >
466
- < li > [=Shortcut item's=] [=shortcut item/description=] member.
467
- </ li >
468
- </ ul >
469
454
< p >
470
455
The < dfn > text-directions</ dfn > are the following, implying that the
471
456
value of the < a > localizable members</ a > is by default:
593
578
"manifest "> name</ dfn > </ code > member is a < a > string</ a > that
594
579
represents the name of the web application as it is usually displayed
595
580
to the user (e.g., amongst a list of other applications, or as a
596
- label for an icon).
581
+ label for an icon). This member is a [=localizable member=].
597
582
</ p >
598
583
< p >
599
584
The [=manifest/name=] member serves as the < a data-cite =
614
599
"manifest "> short_name</ dfn > </ code > member is a < a > string</ a > that
615
600
represents a short version of the name of the web application. It is
616
601
intended to be used where there is insufficient space to display the
617
- full name of the web application.
602
+ full name of the web application. This member is a [=localizable
603
+ member=].
618
604
</ p >
619
605
< p class ="note " title ="Processing the `short_name` member ">
620
606
When [=processing a manifest=], the [=process a text member=]
@@ -675,6 +661,10 @@ <h3>
675
661
an < abbr title ="Operating system "> OS</ abbr > 's task switcher and/or
676
662
system preferences.
677
663
</ p >
664
+ < p >
665
+ This member is a [=localizable member=]. Setting a [=text-direction=]
666
+ is not supported and will be ignored.
667
+ </ p >
678
668
< aside class ="note ">
679
669
< p >
680
670
When [=processing a manifest=], the [=process image resources=]
@@ -1280,6 +1270,158 @@ <h3>
1280
1270
conventions or limitations of the host operating system.
1281
1271
</ p >
1282
1272
</ section >
1273
+ < section >
1274
+ < h3 >
1275
+ `*_localized` members
1276
+ </ h3 >
1277
+ < p >
1278
+ A < dfn > localizable member</ dfn > is a [=manifest=] member that can be
1279
+ localized. Each [=localizable member=] of the [=manifest=] has a
1280
+ corresponding < dfn > localized member</ dfn > with the suffix
1281
+ `_localized`. For example, the [=manifest/name=] member is a
1282
+ [=localizable member=], where `name_localized` is the corresponding
1283
+ [=localized member=].
1284
+ </ p >
1285
+ < p >
1286
+ [=Localized members=] contain a [=localization map=] that defines
1287
+ [=localized values=] for different locales denoted by a [=language
1288
+ tag=]. If present and if the [=localization map=] contains a
1289
+ [=localized value=] that matches the user's localization settings,
1290
+ the user agent SHOULD override the value of the [=localizable
1291
+ member=].
1292
+ </ p >
1293
+ < aside class ="example " title =
1294
+ "Overriding the application name with localized values ">
1295
+ < pre class ="json ">
1296
+ {
1297
+ "lang": "en-US",
1298
+ "name": "Color Picker",
1299
+ "name_localized": {
1300
+ "en-GB": "Colour Picker",
1301
+ "fr": "Sélecteur de Couleur"
1302
+ }
1303
+ }
1304
+ </ pre >
1305
+ </ aside >
1306
+ < p >
1307
+ The < dfn > localization map</ dfn > is an [=ordered map=] whose key is a
1308
+ [=language tag=] and whose value is a [=localized value=]. The
1309
+ < dfn > localized value</ dfn > represents the value applied for the
1310
+ [=language tag=] specified as the key. The value matches the type of
1311
+ its corresponding [=localizable member=]. For example, a [=localized
1312
+ value=] for the [=manifest/name=] member could directly be a
1313
+ [=string=].
1314
+ </ p >
1315
+ < p class ="note ">
1316
+ To support multilingual content and ensure proper display and
1317
+ accessibility, it is possible to specify a different language tag and
1318
+ text direction for a localized value. This is needed for situations
1319
+ where a term or text must be presented in a language different from
1320
+ the user's set language.
1321
+ </ p >
1322
+ < p >
1323
+ Alternatively, the [=localized value=] can be an [=ordered map=]
1324
+ consisting of a `lang`, `dir`, and `value` member, where the `lang`
1325
+ member is a [=language tag=], `dir` is a [=text-direction=], and
1326
+ `value` contains the localization, matching the type of its
1327
+ corresponding [=localizable member=]. The `lang` and `dir` members
1328
+ are optional. When they are not set, `lang` matches the [=language
1329
+ tag=] of the key, and `dir` matches the [=manifest/dir=] member of
1330
+ the [=manifest=].
1331
+ <!-- todo: maybe processed value of dir? or the default dir of the locale? -->
1332
+ </ p > <!-- todo: better example -->
1333
+ < aside class ="example " title ="Advanced localization example ">
1334
+ < pre class ="json ">
1335
+ {
1336
+ "lang": "en-US",
1337
+ "dir": "ltr",
1338
+ "shortcuts": [{
1339
+ "description": "Change language",
1340
+ "description_localized": {
1341
+ "ar": { "lang": "en", "dir": "ltr", "value": "Change language" }
1342
+ },
1343
+ "icons": [{
1344
+ "src": "/icons/play-later.svg",
1345
+ "type": "image/svg+xml"
1346
+ }],
1347
+ "icons_localized": {
1348
+ "ar": [{
1349
+ "src": "/icons/ar/play-later.svg",
1350
+ "type": "image/svg+xml"
1351
+ }]
1352
+ }
1353
+ }]
1354
+ }
1355
+ </ pre >
1356
+ </ aside >
1357
+ < p >
1358
+ <!-- todo: is there an "any" type? -->
1359
+ To < dfn > normalize the localized value</ dfn > , given |localizedValue|,
1360
+ [=string=] |languageTag:string|, and [=ordered map=]
1361
+ |manifest:ordered map|:
1362
+ </ p >
1363
+ < ol class ="algorithm ">
1364
+ < li > Let |normalizedValue| be an [=ordered map=].
1365
+ </ li >
1366
+ < li > If |localizedValue| is an [=ordered map=], and "value"
1367
+ [=map/exists=] in |localizedValue|:
1368
+ < ol >
1369
+ < li > [=map/Set=] |normalizedValue|["value"] to
1370
+ |localizedValue|["value"].
1371
+ </ li >
1372
+ < li > If "lang" [=map/exists=] in |localizedValue|, [=map/set=]
1373
+ |normalizedValue|["lang"] to |localizedValue|["lang"].
1374
+ </ li >
1375
+ < li > If "dir" [=map/exists=] in |localizedValue|, [=map/set=]
1376
+ |normalizedValue|["dir"] to |localizedValue|["dir"].
1377
+ </ li >
1378
+ </ ol >
1379
+ </ li >
1380
+ < li > If "value" does not exist in |normalizedValue|, [=map/set=]
1381
+ result["value"] to |localizedValue|.
1382
+ </ li >
1383
+ < li > If "lang" does not exist in |normalizedValue|, [=map/set=]
1384
+ |result|["lang"] to |languageTag|.
1385
+ </ li >
1386
+ < li > If "dir" does not exist in |normalizedValue|, [=map/set=]
1387
+ |normalizedValue|["dir"] to |manifest|["dir"].
1388
+ </ li >
1389
+ < li > Return |normalizedValue|.
1390
+ </ li >
1391
+ </ ol >
1392
+ < p >
1393
+ To < dfn > process a localizable member</ dfn > , given [=string=]
1394
+ |localizableMemberName| and [=ordered map=] |json|:
1395
+ </ p > <!-- todo: use algorithm when processing manifest -->
1396
+ < ol class ="algorithm ">
1397
+ < li > Let |localizedMemberName| be the [=string/concatenation=] of the
1398
+ [=list=] « |localizableMemberName|, "_localized" ».
1399
+ </ li >
1400
+ < li > If |localizedMemberName| [=map/exists=] in |json|:
1401
+ < ol >
1402
+ < li > Let |localizedMember| be |json|[|localizedMemberName|].
1403
+ </ li >
1404
+ < li > If |localizedMember| is not an [=ordered map=], continue.
1405
+ </ li > <!-- todo: any existing algorithm for this? -->
1406
+ <!-- todo: also take manifest's own lang into account -->
1407
+ < li > Let |languageKey| be the most suitable language key based on
1408
+ the user's localization settings from the [=map/keys=] of
1409
+ |localizedMember|.
1410
+ </ li >
1411
+ < li > If |languageKey| has a value, return the result of
1412
+ [=normalize the localized value=], passing
1413
+ |localizedMember|[|languageKey|], |languageKey|, and |manifest|.
1414
+ </ li >
1415
+ </ ol >
1416
+ </ li > <!-- todo: ensure lang was set during processing -->
1417
+ < li > If |localizableMemberName| [=map/exists=] in |json|, return the
1418
+ result of [=normalize the localized value=], passing
1419
+ |json|[|localizableMemberName|], |manifest|["lang"], and |manifest|.
1420
+ </ li >
1421
+ < li > Otherwise, return.
1422
+ </ li >
1423
+ </ ol >
1424
+ </ section >
1283
1425
< section >
1284
1426
< h2 >
1285
1427
Manifest life-cycle
@@ -1664,10 +1806,9 @@ <h3>
1664
1806
</ dt >
1665
1807
< dd >
1666
1808
The user agent is free to display the icon where no [=manifest
1667
- image resource/purpose=] is required. For example, a
1668
- [=manifest image resource=] with a "any" purpose
1669
- wouldn't be used in a context where "[=icon purpose/monochrome=]"
1670
- is required.
1809
+ image resource/purpose=] is required. For example, a [=manifest
1810
+ image resource=] with a "any" purpose wouldn't be used in a context
1811
+ where "[=icon purpose/monochrome=]" is required.
1671
1812
</ dd >
1672
1813
</ dl >
1673
1814
< p >
@@ -2043,7 +2184,7 @@ <h3>
2043
2184
The [=shortcut item's=] < code > < dfn data-dfn-for =
2044
2185
"shortcut item "> name</ dfn > </ code > member is a < a > string</ a > that
2045
2186
represents the name of the shortcut as it is usually displayed to the
2046
- user in a context menu.
2187
+ user in a context menu. This member is a [=localizable member=].
2047
2188
</ p >
2048
2189
</ section >
2049
2190
< section >
@@ -2055,7 +2196,7 @@ <h3>
2055
2196
"shortcut item "> short_name</ dfn > </ code > member is a < a > string</ a >
2056
2197
that represents a short version of the name of the shortcut. It is
2057
2198
intended to be used where there is insufficient space to display the
2058
- full name of the shortcut.
2199
+ full name of the shortcut. This member is a [=localizable member=].
2059
2200
</ p >
2060
2201
</ section >
2061
2202
< section >
@@ -2066,7 +2207,8 @@ <h3>
2066
2207
The [=shortcut item's=] < code > < dfn data-dfn-for =
2067
2208
"shortcut item "> description</ dfn > </ code > member is a < a > string</ a >
2068
2209
that allows the developer to describe the purpose of the shortcut.
2069
- User agents MAY expose this information to assistive technology.
2210
+ User agents MAY expose this information to assistive technology. This
2211
+ member is a [=localizable member=].
2070
2212
</ p >
2071
2213
</ section >
2072
2214
< section >
@@ -2089,6 +2231,10 @@ <h3>
2089
2231
"shortcut item "> icons</ dfn > </ code > member lists images that serve as
2090
2232
iconic representations of the shortcut in various contexts.
2091
2233
</ p >
2234
+ < p >
2235
+ This member is a [=localizable member=]. Setting a [=text-direction=]
2236
+ is not supported and will be ignored.
2237
+ </ p >
2092
2238
</ section >
2093
2239
< section >
2094
2240
< h3 >
@@ -3320,6 +3466,13 @@ <h2>
3320
3466
using one of the following options:
3321
3467
</ p >
3322
3468
< dl >
3469
+ < dt >
3470
+ Localized values in the manifest:
3471
+ </ dt >
3472
+ < dd >
3473
+ Authors can provide [=localized values=] for the [=localizable
3474
+ members=] of the [=manifest=].
3475
+ </ dd >
3323
3476
< dt >
3324
3477
Dynamically setting the language:
3325
3478
</ dt >
0 commit comments