Generating figure link text by language
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 806
- Forks
- 434
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 32
Description
- URL to affected spec: https://w3c.github.io/jlreq/#elements-of-page-formats (replace jlreq with clreq or klreq for other documents to which this applies)
- ReSpec version: 24.21.4
- I did a "hard refresh", but it's still busted.
When generating links to figures, respec creates link text such as "Figure 15" for english documents. If the html tag has lang="ja", it generates "図15".
However, in the multilingual documents mentioned above this doesn't work well. You end up with english everywhere because on the initial load the html lang attribute is set to en, eg.
The following are the basic elements of a page format. Figure 11 illustrates an example of a page format in vertical writing mode).
基本となる組体裁の主な設計要素としては,次がある(縦組の例をFigure 11に示す).
Rather than only checking the setting of the html tag, it would be better to check the language of the text being converted, so that the outcome would be:
The following are the basic elements of a page format. Figure 11 illustrates an example of a page format in vertical writing mode).
基本となる組体裁の主な設計要素としては,次がある(縦組の例を図11に示す).
However, there is another issue with the (large) multilingual docs currently being used by i18n folks: since each item of japanese text has its-locale-filter-list="ja" already, lang attributes are currently added by scripting after the page loads (in order to make life easier for content authors).
There appear to be the following possible solutions for jlreq, clreq & klreq docs:
- add
langattributes to the source text everwhere there areits-locale-filter-listattributes (rather than apply those by scripting), and require authors to addlangtags in future, then use thoselangtags to determine whether the link text needs to be localised - use
its-locale-filter-listattributes in the algorithm to determine whether to use english or localised link text. (There is a small twist in that clreq currently uses data-lang rather than its-locale-filter-list, but we can change that.)
The second approach may actually be appropriate for multilingual docs, since that attribute indicates the location of the localised version of a string, however, for the case where we produce a monolingual Japanese document (for example) with no need for its- attributes, we'd need to rely on lang tags. So maybe (1) is the better approach(?)
Thoughts?
cc @xfq @himorin @kidayasuo
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the figure-link generation behavior affecting the jlreq, clreq, and klreq specifications, and compare how lang, its-locale-filter-list, and data-lang are applied. Define and test a language-selection approach that produces localized figure link text in multilingual documents while preserving the existing behavior for monolingual documents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation, internationalization
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100