Closed NekoJonez closed 1 year ago
These source files are generated with a content parser from the site content edited in the editor, so we can't manually add a translation comment - it would be stripped out the next time the page was synced (this explains the process a little more).
Maybe we could update the parser so that if it sees something like [text]
it adds in a note? Hm, that would probably catch [legitimate-content] too. The parser doesn't load WordPress, so we can't check against registered shortcodes. That's probably solvable though, by updating it to a wp-cli script if nothing else 🤔
What kind of note would work? For example, would this be okay?
<!-- wp:paragraph {"textColor":"charcoal-4","className":"is-style-short-text","fontSize":"small"} -->
<p class="is-style-short-text has-charcoal-4-color has-text-color has-small-font-size"><?php
/* translators: [recommended_php], [recommended_mysql], [recommended_mariadb] are shortcodes. */
_e( 'Recommend PHP [recommended_php] or greater and MySQL [recommended_mysql] or MariaDB version [recommended_mariadb] or greater.', 'wporg' );
?></p>
<!-- /wp:paragraph -->
That would work perfectly. Just like how it works in plugins.
Maybe its overkill to say that they shouldnt be translated, but its a good fix
I would recommend the text be /* translators: ...... are shortcode(s) and should not be translated. */
for specificness.
Just match on (\[[a-z_-]{5,}\])
for the shortcodes I think..
Additionally, it might be worth GlotPress/translate.w.org having a warning when shortcodes are detected in content, but not present in the translations (or the shortcodes differ, or additional shortcodes are added, etc).. because we don't really want to allow translators to change shortcodes at all.
Additionally, it might be worth GlotPress/translate.w.org having a warning when shortcodes are detected in content, but not present in the translations (or the shortcodes differ, or additional shortcodes are added, etc).. because we don't really want to allow translators to change shortcodes at all.
Either WPGP Tools or GlotDict has a feature where you easily see the placeholders like %1$s and HTML tags... Also, gives a warning when they are missing. Maybe this feature should be ported over to GlotPress therefore to translate.wp.org. But I think that's the idea that the functionality of the those tools will be intregrated to GlotPress.
Anyhow, that as a total sidenote. I totally agree with Dion.
Since the raise of AI lately, a lot of polyglots are using AI translation. Yet, AI translation sometimes translates shortcodes/placeholders like in this string: https://translate.wordpress.org/projects/meta/wordpress-org/nl-be/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=16046810&filters%5Btranslation_id%5D=105620034
This might break the website in some locales and would case a mess. Shouldn't we add translator notes to NOT translate these words between [ ] ?
Here is an example list: https://translate.wordpress.org/projects/meta/wordpress-org/nl-be/default/?filters%5Bterm%5D=%5B&filters%5Bterm_scope%5D=scope_originals&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&filters%5Buser_login%5D=&filter=Apply+Filters&sort%5Bby%5D=translation_date_modified&sort%5Bhow%5D=desc