question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Localization differences - Address EmbedLiveSample case with its "localized" argument

See original GitHub issue

As far as I understand, EmbedLiveSample macro builds the sample content based on a given heading ID (first parameter) or (I just discovered this) fallbacks without argument by using an algorithm based on content.

The thing is, EmbedLiveSample is:

  • considered as a macro of interest for “localization differences”
  • still vastly using an argument based on the heading ID

As the localization differences take into account macros and their arguments, and as headings’ IDs are generated based on their content… We often encounter what I think are false positive signals when translating (see the first flaw on https://github.com/mdn/translated-content/pull/3158#issuecomment-974766571 for example). Before corresponding PRs it was actually one of the most important source of issues for French content on mdn/translated-content.

There are a few ways to fix this:

  • Remove IDs in EmbedLiveSample macro calls in mdn/content and mdn/translated-content (as it mdn/content acts as the source of truth/reference for mdn/translated-content)
  • Remove EmbedLiveSample from the list of “macros of interest” for localization differences
  • Add some complexity in the localization difference detection algorithm to specifically deal with EmbedLiveSample (and any other macros with arguments based on localizable content)

I’m not sure of the way I prefer. EmbedLiveSample has long been frail regarding l10n (cf. https://github.com/mdn/translated-content/issues/2844 and https://github.com/mdn/translated-content/issues/2842 for example among others).

  • Using no argument as the default would indeed solve the root cause of the issue but updating this in current content would need a large set of changes in mdn/content and mdn/translated-content.
  • Removing EmbedLiveSample from the localization differences check is the most easy one but it feels wrong as, I believe, good live samples are essential to the quality of a page (whether it’s an English or a localized one)
  • Making an exception for EmbedLiveSample in the current algorithm only has an impact on mdn/yari but feels a bit like a “ad hoc” solution.

Pointers:

@escattone @wbamberg @lex111 @mfuji09 @hochan222, let me know if you have any thoughts about this.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
wbambergcommented, Nov 15, 2022

The situation is described above and hasn’t changed. To summarise:

  • EmbedLiveSample is fragile for localizers, because it includes the ID, which is derived from the heading text, which is obviously locale sensitive
  • there is an alternative behavior built into EmbedLiveSample in which the ID can be omitted
  • when we tried using it we found a couple of issues: https://github.com/mdn/yari/issues/4971#issuecomment-981498547 . One of these seems not to be an issue any more, the other is but maybe we could work around it.

If we want to go ahead with the ID-less version (and that’s at least partly a choice for translators, but in this thread they seem pretty keen) then we should make sure it is working properly with our content and consistently use it in en-US and other locales. We should also consider revising the EmbedLiveSample API at the same time (https://github.com/mdn/yari/issues/5016).

2reactions
wbambergcommented, Nov 29, 2021

Was talking this over with Ryan yesterday and it might be a good time to move to a new macro or to revise the arguments it can take. Already it takes 2 arguments that are always ignored (“width” and “hide Codepen buttons”).

Is there a tracking bug to discuss and do this work? Either creating a new macro or refactoring the existing one.

I just filed https://github.com/mdn/yari/issues/5016 for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(Auto)EmbedLiveSample is not working correctly · Issue #5005 ...
A heading {{EmbedLiveSample}} ### HTML (the HTML code block) ... Localization differences - Address EmbedLiveSample case with its "localized" argument #4971.
Read more >
Translation vs. Localization vs. Transcreation: Is there a ...
Localized content for Mexico would be different than localizing content for Argentina or Spain. The same applies to French – after all, French ......
Read more >
stage-integration-tests PDF - Kuma Documentation
Changes made to your local directory are usually reflected in the running containers. To force the issue, the containers for specified ...
Read more >
UDN Search - UDN Web Docs: MDN Backup
... this is because the title attribute on a <link rel="stylesheeet"> element makes it either preferred or an alternative style sheet. ... why...
Read more >
What is Localization? - Amara.org
Localization is the process of adapting language to a local culture's norms and expectations. Languages are not bound by national borders.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found