Live samples in translated-content cannot use images from content
See original GitHub issueSummary
The images used in live sample ({{EmbedLiveSample}}
) are not served (404) when they are not duplicated on mdn/translated-content.
URL
https://developer.mozilla.org/fr/docs/Web/CSS/filter
Reproduction steps
- Go to https://developer.mozilla.org/fr/docs/Web/CSS/filter
- Checkout mdn/translated-content as of e1b9e2c and a local yari
- Compare live samples in the page
Expected behavior
Both (local and production) should match (at least after some time)
Actual behavior
In production https://yari-demos.prod.mdn.mozit.cloud/fr/docs/Web/CSS/filter/test_form_3.jpeg is 404
Device
Laptop
Browser
Firefox
Browser version
Stable
Operating system
Windows
Screenshot
Anything else?
Previously https://github.com/mdn/yari/pull/5215 was merged, it worked locally, I waited a bit and made https://github.com/mdn/translated-content/pull/4549
https://github.com/mdn/translated-content/issues/3752
Validations
- I have read the Community Participation Guidelines.
- I have verified that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- I have checked that this is a concrete bug. For Q&A open a GitHub Discussion.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Copy and translate text from photos on your iPhone or iPad
Use Live Text to get information from photos and images · Open the Settings app. · Tap General. · Tap Language & Region,...
Read more >Media Translation - How to translate your site's images - Weglot
Media translation is key for a full website localization experience. Learn how to translate images, videos, and other media on your site.
Read more >Localizing help center content - Zendesk help
Click Edit section or Edit category in the top menu bar. Select a language for the translation you want to add from the...
Read more >Use Information Correctly: Copyright and Fair Use - GCF Global
Learn about copyright and fair use issues facing writers today in this free lesson. It's especially important in the age of digital technology....
Read more >1.1.1 Non-text Content - Understanding WCAG 2.0 - W3C
Transparent images used to move text over on a page; an invisible image that is used to track usage statistics; and a swirl...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have finally discussed this is in the engineering meeting today, and we will proceed by copying the referenced content images next to the translated-content during build.
A new idea about this:
We are now hosting about 9 locales. And we may modify the request before finding the file hosted on aws-S3 (so we can reduce redirects for those images which have to fallback to
en-US
, the method metioned above)So, we may go on this way (similar to the redirect logic of lambda@edge):
mdn/content
reporequest.uri
toen-us
folder.The problem is, there are too many images that are not in most l10n folders:
So this may not be a good idea to store each not-existed l10n image file path. (if there are 4000 image files in mdn/content in the future, we should store about 40000 filepaths).
Another way to flag those file is
bitwise
flag (just like the Unix Octal permissions):For each locale, we use a
powers of 2
number to present. For example:If
path/to/image
does not exist infr
andzh-cn
(but in other locales), we can compress the flags by sum up all the numbers:2
(for zh-cn) +8
(for fr) =10
.In Origin request, we can:
path/to/image
exists infr
:10
(for sumed flags) &8
(for fr) = 1. The result is not zero, so the image is not infr
.path/to/image
exists inzh-tw
:10
(for sumed flags) &4
(for zh-tw) = 0. The result is zero, so the image is inzh-tw
.For the sumed flags, we can just use a map to present (easy to stored as a json file):
And in JavaScript, the bitwise operation is safe for 32-bit integer, so we can host 32 locales at most. I think it’s enough for us for a long time (when we host more than 32 locales, we may have a new design about image file hosting)
Filled in #6644.