Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate KS macros never used in en-US #3063

Closed
peterbe opened this issue Feb 25, 2021 · 7 comments
Closed

Deprecate KS macros never used in en-US #3063

peterbe opened this issue Feb 25, 2021 · 7 comments
Labels
🐌 idle Issues and PRs without recent activity. Flagged for maintainer follow-up. macros tracking issues related to kumascript macros

Comments

@peterbe
Copy link
Contributor

peterbe commented Feb 25, 2021

When I worked on #1274 I noticed there are a lot more macros that would be considered never-used if you focus on the en-US content alone. For example:

MOZILLA/MDN/content  main ✔
▶ rg -i b2gonlyheader2

MOZILLA/MDN/content  main ✔
▶ cd ../translated-content

MOZILLA/MDN/translated-content  main ✔
▶ rg -i b2gonlyheader2
files/zh-tw/web/api/permissions_api/index.html
9:<p>{{ B2GOnlyHeader2('certified') }}</p>

So, that macro is never used in the en-US content, but it's used in greater-than-zero places in the translated-content.

What we could do is edit these macros so they're marked as deprecated and just return an empty string.

Here's a complete list of macros that exist but are only used in translated-content:

kumascript/macros/CompatGeckoDesktop.ejs           8728
kumascript/macros/CompatibilityTable.ejs           8519
kumascript/macros/CompatGeckoMobile.ejs            6437
kumascript/macros/CompatVersionUnknown.ejs         5883
kumascript/macros/CompatUnknown.ejs                3950
kumascript/macros/languages.ejs                    1997
kumascript/macros/web.link.ejs                     1211
kumascript/macros/IncludeSubnav.ejs                699
kumascript/macros/CompatIE.ejs                     655
kumascript/macros/CompatSafari.ejs                 628
kumascript/macros/HTMLVersionInline.ejs            456
kumascript/macros/Obsolete_Header.ejs              454
kumascript/macros/英語版章題.ejs                        439
kumascript/macros/CSSTutorialTOC.ejs               182
kumascript/macros/previousPage.ejs                 158
kumascript/macros/nextPage.ejs                     151
kumascript/macros/DOM0.ejs                         151
kumascript/macros/CompatAndroid.ejs                143
kumascript/macros/jsOverrides.ejs                  121
kumascript/macros/訳注.ejs                           118
kumascript/macros/原語併記.ejs                         88
kumascript/macros/HTML5ArticleTOC.ejs              77
kumascript/macros/EditorGuideQuicklinks.ejs        42
kumascript/macros/gecko_callout_heading.ejs        38
kumascript/macros/IRCLink.ejs                      26
kumascript/macros/ref.ejs                          25
kumascript/macros/gecko_minversion_note.ejs        22
kumascript/macros/h1_gecko_minversion.ejs          20
kumascript/macros/FontAwesomeIcon.ejs              11
kumascript/macros/endnote.ejs                      11
kumascript/macros/h2_gecko_minversion.ejs          10
kumascript/macros/UserLink.ejs                     9
kumascript/macros/訳語.ejs                           6
kumascript/macros/LXRSearch.ejs                    2
kumascript/macros/tree.ejs                         2
kumascript/macros/B2GOnlyHeader2.ejs               1
@peterbe
Copy link
Contributor Author

peterbe commented Feb 25, 2021

@escattone @chrisdavidmills What do you think about this?

A "fear" I have is that some ancient translation might have used these like this:

(imagine this is NOT in English)

<p>See list link for a thing about: {{LXRSearch("something")}}</p>

If you render that to become an empty string you end up with:

<p>See list link for a thing about: </p>

which looks bad.

Perhaps a more industrious solution would be to mark all of these macros as deprecated but keep their functionality.
Then it becomes a flaw (on the translated content) that says:

`EditorGuideQuicklinks` is a deprecated macro not used. Please remove.

@peterbe
Copy link
Contributor Author

peterbe commented Apr 20, 2021

@escattone How about we just delete them? I.e. if a translated page still uses {{CompatAndroid(...)}} the answer is to spend time on that and fix it so it gets the same {{Compat(...)}} call as its en-US equivalent. That's probably better than attempting to display whatever unpredictable and unsupported stuff CompatAndroid.ejs might produce.

Also, once the translators have #3106 they'll clearly see which old busted KS macros they're using that needs to be changed.

@tristantheb
Copy link
Member

tristantheb commented Apr 20, 2021

Having already started for l10n-FR mdn/translated-content#311 and the Japanese community having also done so for l10n-JA mdn/translated-content#356, I can always take some time (e.g. from April 26 to May 2) to prepare a PR (May 2 at night max) with the cleanup of all the locales for at least the Compat<XXX> macros

This will reduce the list already, and will make it possible to worry about the others macros which are less present and which may sometimes require replacing by text, links, etc...

@mfuji09
Copy link
Contributor

mfuji09 commented Apr 21, 2021

There are four macros used in Japanese translation only. I agree with to remove them and to replace with other expressions.
I will ask the l10n-ja community for help in removing them.

kumascript/macros/英語版章題.ejs 439
kumascript/macros/訳注.ejs 118
kumascript/macros/原語併記.ejs 88
kumascript/macros/訳語.ejs 6

@escattone
Copy link
Contributor

@escattone How about we just delete them? I.e. if a translated page still uses {{CompatAndroid(...)}} the answer is to spend time on that and fix it so it gets the same {{Compat(...)}} call as its en-US equivalent. That's probably better than attempting to display whatever unpredictable and unsupported stuff CompatAndroid.ejs might produce.

I think that's best, to just delete them, unless they're useful as a means to identify translated pages that need to updated to match their English equivalent? I would vote for deleting them.

@peterbe
Copy link
Contributor Author

peterbe commented Apr 21, 2021

How about we start with that (apart from the Japanese ones that @mfuji09 would like to leave for a little while longer).
Then, if we notice any macro that fails in prod builds (i.e. when it fails it just prints the macro call verbatim in formatted text) becomes obvious in that they need fixing.

So, once @tristantheb 's many PRs have been merged we can start git rm'ing the .ejs files from Yari.

@queengooborg
Copy link
Collaborator

Deprecation has been done in #6251 and #6252, now all that's left is to remove them!

@github-actions github-actions bot removed the 🐌 idle Issues and PRs without recent activity. Flagged for maintainer follow-up. label May 12, 2022
@github-actions github-actions bot added the 🐌 idle Issues and PRs without recent activity. Flagged for maintainer follow-up. label Jun 19, 2022
@caugner caugner closed this as completed Nov 15, 2022
Repository owner moved this from Backlog to Done in Yari Platform Engineering Nov 15, 2022
@caugner caugner added the macros tracking issues related to kumascript macros label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐌 idle Issues and PRs without recent activity. Flagged for maintainer follow-up. macros tracking issues related to kumascript macros
Projects
Development

No branches or pull requests

7 participants