[BZ#761482] SystemLanguage handler fail to meet the w3c standard about language fallback
Submitted by Philip Tzou
Link to original bug (#761482)
Description
Created attachment 320311 Patch
The most latest version of librsvg doesn't respect the language fallback defined by W3C very well. In the sentence "As an example, users may assume that on selecting "en-GB", they will be served any kind of English document if British English is not available." (https://www.w3.org/TR/SVGTiny12/struct.html#SystemLanguageAttribute), it does respect "any kind of English document" but ignored "if British English is not available".
Also, there're a few small bugs I also fixed along with this patch:
- If system language comes with an underscore (_) like "en_GB", the match result was incorrect.
- If system language comes with a dot (.) like "en.UTF-8", the match result was also incorrect.
Proof (use the svg file I attached):
LANG=en-GB rsvg-convert systemLanguageTest.svg -o test_en-GB.png
LANG=en_GB rsvg-convert systemLanguageTest.svg -o test_en_GB.png
LANG=en.UTF-8 rsvg-convert systemLanguageTest.svg -o test_en.UTF-8.png
I already craft a patch for this (see attachment too) but it doesn't include any new test case. Appreciate in advance if anyone can provide the test case(s).
Patch 320311, "Patch":
systemLanguageFallback.patch