Making WordPress.org

Opened 8 months ago

Closed 7 days ago

#8213 closed defect (bug) (fixed)

Some meta/wordpress-org strings are not meant to be translated, therefore preparing them for localization is not necessary

Reported by: fierevere Owned by:
Priority: normal Milestone:
Component: WordPress.org Site Keywords: has-patch has-unit-tests
Cc:

Description

Some meta/wordpress-org strings are not meant to be translated, therefore preparing them for localization is not necessary

Issues with numbers,
1) they are subject to change (therefore will be fuzzied on string update)
2) there are almost no variations on how they can be localized
strings:
​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/education-campus-connect.php#L92

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/education-campus-connect.php#L82

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/education-campus-connect.php#L72

Issues with cookie names,
while "wp-postpass_{hash}" may have partial translation (for word 'hash'), the other cookie names like _ga or devicePixelRatio shall remain unchanged. Perhaps its also a better idea to remove them from translateable strings. Only descriptions need to be translated.

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/about-privacy-cookies.php#L95

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/about-privacy-cookies.php#L87

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/about-privacy-cookies.php#L63

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/about-privacy-cookies.php#L71

​https://github.com/WordPress/wporg-main-2022/blob/trunk/source/wp-content/themes/wporg-main-2022/patterns/about-privacy-cookies.php#L79

wp-postpass_{hash}
wp-settings-{user}
wp-settings-time-{user}
tix_view_token
jetpackState
jpp_math_pass
stnojs
wordpress_logged_in_{hash}
comment_author_email_{hash}
comment_author_url_{hash}
codexUserName
codex_session
camptix_client_stats
wp-saving-post
comment_author_{hash}
wporg_logged_in
wporg_sec
wporg_locale
welcome-{blog_id}
showComments
trac_form_token
trac_session
codexToken
codexUserId
devicePixelRatio
wordpress_test_cookie
_ga
_gid
tk_ai
tk_lr
tk_or
wp-settings-{user_id}

Change History (2)

This ticket was mentioned in ​PR #665 on ​WordPress/wporg-main-2022 by ​@dd32.


8 months ago
#1

  • Keywords has-patch has-unit-tests added

## Summary

  • Adds support for the notranslate CSS class on blocks to prevent their content from being wrapped in esc_html_e() / _e() during pattern export
  • When a block has notranslate in its "Additional CSS class(es)" field, the block and all its inner blocks are skipped during string extraction — content stays as plain HTML
  • The notranslate class was chosen for compatibility with Google Translate and other browser translation tools. In future, the HTML translate="no" attribute could also be supported.

Note: After merging, the WordPress editor content for the affected pages (cookie policy, education campus connect) will need the notranslate class added to the relevant blocks, then patterns regenerated.

Fixes https://meta.trac.wordpress.org/ticket/8213

## Test plan

  • [x] All 38 existing + new unit tests pass
  • [ ] Add notranslate class to a block in the editor, run yarn build:patterns, verify the block content is not wrapped in translation functions
  • [ ] Verify blocks without the class are still wrapped normally

🤖 Generated with ​Claude Code

#2 @obenland
7 days ago

  • Resolution → fixed
  • Status new → closed

The cookie names in the *.wordcamp.org table are now marked notranslate on the Cookie Policy page, like the other cookie tables, so they’re no longer sent out for translation. Synced to the pattern in ​https://github.com/WordPress/wporg-main-2022/pull/776.

Note: See TracTickets for help on using tickets.