?
avatar sanek4life
sanek4life
5 Mar 2020

Is your feature request related to a problem? Please describe.

There are menu items on my website that are brand names. I went to my website from Google Chrome browser and clicked "translate page", and I saw that the menu items with brand names on my websites were translated. The names of these menu items should not have been translated, as in all languages they should be written in English.

Describe the solution you'd like

I suggest adding the html tag "translate" to the menu items so that you can specify in the settings whether it is possible to translate the name of this menu item or not (or not to use this html tag for the menu).

Translate menu item:

  • Don't use meta tag
  • Yes
  • No

In the text of Articles I can add this html tag "translate" for selected words myself, but I can not add this html tag "translate" for the names of menu items myself.

изображение

The translate attribute in HTML5 indicates that the content of the element should or should not be translated. There is no effect on the rendered page (although you could, of course, style it if you found a good reason for doing so). For example,
<h1>Using HTML's <span class="kw" translate="no">translate</span> attribute</h1>

The attribute can appear on any element, and it takes just two values: yes or no. If the value is no, translation tools should protect the text of the element from translation. The translation tool in question could be an automated translation engine, like those used in the online services offered by Google, Microsoft and Yandex. Or it could be a human translator's 'workbench' tool, which would prevent the translator inadvertently changing the text.

Setting this translate flag on an element applies the value to all contained element content. HTML5 has a list of attributes that are to be translated by default, but these attributes should not be translated if they are on an element where translate is set to no. Otherwise attributes should not be translated.

If a page has no translate attribute, a translation system or translator should assume that all the text is to be translated. The yes value is therefore likely to see little use, though it could be very useful if you need to override a translate flag on a parent element and indicate some bits of text that should be translated. You may want to translate the natural language text in examples of source code, for example, but leave the code untranslated.

Additional context

The translate global attribute is an enumerated attribute that is used to specify whether an element's translateable attribute values and its Text node children should be translated when the page is localized, or whether to leave them unchanged. It can have the following values:

  • empty string or "yes", which indicates that the element should be translated when the page is localized.
  • "no", which indicates that the element must not be translated.

Although not all browsers recognize this attribute, it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. As such it's important that web authors use this attribute to mark content that should not be translated.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate
W3: https://www.w3.org/International/questions/qa-translate-flag

avatar sanek4life sanek4life - open - 5 Mar 2020
avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Mar 2020
avatar sanek4life sanek4life - change - 5 Mar 2020
Title
HTML tag "translate" for the names of menu items
HTML tag "translate" for the names of menu titles
avatar sanek4life sanek4life - edited - 5 Mar 2020
avatar gerryfrancis
gerryfrancis - comment - 5 Mar 2020

@sanek4life The menu title in the example you have described is named "New Tree (as an example, a non-existent music group)". I guess your use case would be just "New Tree", right?

it's important that web authors use this attribute to mark content that should not be translated.

E.g. custom fields?

How would you deal with the appearance of the band name in one or more paragraphs of this or another article?

avatar sanek4life
sanek4life - comment - 5 Mar 2020

I guess your use case would be just "New Tree", right?

yes

E.g. custom fields?

This is not an additional field (such as video or audio field). This is the HTML tag that is added for the menu title so that the menu name does not translate.

I hope you understand what I'm writing.

avatar gerryfrancis
gerryfrancis - comment - 5 Mar 2020

I hope you understand what I'm writing.

I have understood very well. You have been writing about content, and a menu title is not the only content that appears on a website. How should an article about "New Tree" be handled?

avatar sanek4life
sanek4life - comment - 5 Mar 2020

I hope you understand what I'm writing.

I have understood very well. You have been writing about content, and a menu title is not the only content that appears on a website. How should an article about "New Tree" be handled?

In the Article, you can insert these HTML tag translate manually (via wysiwyg editor). For the title of the article, this is currently not possible. Therefore, I suggest adding this html tag translate for the title of the article (for the title of a menu item).

This is like an HTML tag rel=follow, only this tag is for the title, and not for the whole article.

In the article, we can independently add this tag for each word we need, it is now possible, but it is not possible to do for the title (for the name of a menu item)

avatar sanek4life sanek4life - change - 5 Mar 2020
Title
HTML tag "translate" for the names of menu titles
HTML tag "translate" for the name of menu title
avatar sanek4life sanek4life - edited - 5 Mar 2020
avatar sanek4life
sanek4life - comment - 5 Mar 2020

изображение

@gerryfrancis This is what I mean. (Only the name of the menu item, this does not apply to any words that are in the article)

avatar infograf768
infograf768 - comment - 5 Mar 2020

If a PR is proposed and accepted, for J4, it should not be limited to menu items titles, but also article titles, modules titles, contacts titles

avatar sanek4life
sanek4life - comment - 5 Mar 2020

If a PR is proposed and accepted, for J4, it should not be limited to menu items titles, but also article titles, modules titles, contacts titles

It would be great!

This is indeed a very important function not only for multilingual websites, but also for any websites. This will help to correctly translate "brand names" and other names in articles and menu items if, for example, the user has visited French website and wants to translate this website into English or Russian through an translator (built-in Google Chrome browser) (as an example).

avatar infograf768
infograf768 - comment - 5 Mar 2020

Let’s clarify here: It has nothing to do with multilingual joomla and it does not concern either lang packs translations.

avatar sanek4life
sanek4life - comment - 5 Mar 2020

Let’s clarify here: It has nothing to do with multilingual joomla and it does not concern either lang packs translations.

Absolutely right. This is the html tag.

avatar sanek4life
sanek4life - comment - 5 Mar 2020

Let’s clarify here: It has nothing to do with multilingual joomla and it does not concern either lang packs translations.

It looks like this:

<p>The <code class="kw" translate="no">translate</code> attribute</p>

avatar brianteeman
brianteeman - comment - 5 Mar 2020

If I remember correctly google etc also support this no translate functionality by adding a class

class="notranslate"

avatar jwaisner jwaisner - change - 5 Mar 2020
Build staging 4.0-dev
avatar jwaisner jwaisner - change - 5 Mar 2020
Category Feature Request
avatar sanek4life
sanek4life - comment - 5 Mar 2020

If I remember correctly google etc also support this no translate functionality by adding a class

class="notranslate"

Yes, Google accepts this tag, but it acts globally on the entire page, on every word.

But I am writing about excluding the translation of individual words on the page (and not the entire page). But this tag can also be added where there is a setting for follow/nofollow (if necessary).

<meta name="google" content="notranslate" />

https://support.google.com/webmasters/answer/79812

avatar brianteeman
brianteeman - comment - 5 Mar 2020

the tag I wrote was class= not content= :)

https://webmasters.googleblog.com/2008/10/helping-you-break-language-barrier.html

As it is a class you can apply it to the menu without any code changes

avatar sanek4life
sanek4life - comment - 5 Mar 2020

<span title="Englisch"><a href="article.en.html" translate="no" lang="en">English</a></span>

Title without Translate (HTML5)

https://www.w3.org/International/questions/qa-translate-flag#attributes

avatar sanek4life
sanek4life - comment - 5 Mar 2020

the tag I wrote was class= not content= :)

https://webmasters.googleblog.com/2008/10/helping-you-break-language-barrier.html

As it is a class you can apply it to the menu without any code changes

Legacy approaches for online translation services

Before the translate attribute was defined, both Google and Microsoft online translation services supported a number of other, non-standard ways to express similar ideas.

Both Google and Microsoft support class="notranslate", but replacing a class attribute value with an attribute that is a formal part of the language makes this feature much more reliable, especially in wider contexts. For example, a translation prep tool would be able to rely on the meaning of the HTML5 translate attribute always being what is expected. Also it becomes easier to port the concept to other scenarios, such as other translation APIs or localization standards such as XLIFF.

Microsoft apparently supports style="notranslate". This is not one of the options Google lists for their online service, but on the other hand they have things that are not available via Microsoft's service.

For example, if you have an entire page that should not be translated, you can add <meta name="google" value="notranslate"> inside the head element of your page and Google won't translate any of the content on that page. (However they also support <meta name="google" content="notranslate">.) This shouldn't be Google specific, and a single way of doing this, ie. translate="no" on the html tag, is far cleaner.

Microsoft and Google's translation engines also don't translate content within code elements. Note, however, that you don't seem to have any choice about this – there don't seem to be instructions about how to override this if you do want your code element content translated.

As already mentioned, the new HTML5 translate attribute provides a simple and standard feature of HTML that can replace and simplify all these different approaches, and will help authors develop content that will work with other systems too.

Source: https://www.w3.org/International/questions/qa-translate-flag#stickyness

avatar sanek4life
sanek4life - comment - 5 Mar 2020

This attribute "translate" is recommended to be added to the website, as recommended by HTML5:

изображение

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes

Source №2: https://www.w3.org/TR/html52/dom.html#global-attributes

avatar brianteeman
brianteeman - comment - 5 Mar 2020

I was offering you a way to do it right now. Might not have been perfect
and definitely could be improved but you could do it today and not after
upgrading to joomla 4 in 2021

On Thu, 5 Mar 2020 at 19:18, sanek4life notifications@github.com wrote:

the tag I wrote was class= not content= :)

https://webmasters.googleblog.com/2008/10/helping-you-break-language-barrier.html

As it is a class you can apply it to the menu without any code changes

Legacy approaches for online translation services

Before the translate attribute was defined, both Google and Microsoft
online translation services supported a number of other, non-standard ways
to express similar ideas.

Both Google and Microsoft support class="notranslate", but replacing a
class attribute value with an attribute that is a formal part of the
language makes this feature much more reliable, especially in wider
contexts. For example, a translation prep tool would be able to rely on the
meaning of the HTML5 translate attribute always being what is expected.
Also it becomes easier to port the concept to other scenarios, such as
other translation APIs or localization standards such as XLIFF
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xliff.

Microsoft apparently supports style="notranslate". This is not one of the
options Google lists for their online service, but on the other hand they
have things that are not available via Microsoft's service.

For example, if you have an entire page that should not be translated, you
can add inside the head element
of your page and Google won't translate any of the content on that page.
(However they also support .)
This shouldn't be Google specific, and a single way of doing this, ie.
translate="no" on the html tag, is far cleaner.

Microsoft and Google's translation engines also don't translate content
within code elements. Note, however, that you don't seem to have any
choice about this – there don't seem to be instructions about how to
override this if you do want your code element content translated.

As already mentioned, the new HTML5 translate attribute provides a simple
and standard feature of HTML that can replace and simplify all these
different approaches, and will help authors develop content that will work
with other systems too.

Source:
https://www.w3.org/International/questions/qa-translate-flag#stickyness


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/joomla/joomla-cms/issues/28238?email_source=notifications&email_token=AAJ4P4OPMSSAR4UZOVLA2T3RF73H3A5CNFSM4LCJA4MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN6RKAQ#issuecomment-595399938,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAJ4P4L7XU353NFOCCXJSC3RF73H3ANCNFSM4LCJA4MA
.

--
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/

avatar sanek4life
sanek4life - comment - 5 Mar 2020

I was offering you a way to do it right now. Might not have been perfect and definitely could be improved but you could do it today and not after upgrading to joomla 4 in 2021

In any case, it's nice to hear that someday it will be added to Joomla.

avatar sanek4life sanek4life - change - 5 Mar 2020
Title
HTML tag "translate" for the name of menu title
HTML5 attribute "translate" for the name of menu title
avatar sanek4life sanek4life - edited - 5 Mar 2020
avatar infograf768
infograf768 - comment - 6 Mar 2020

In any case, it's nice to hear that someday it will be added to Joomla.

If someone proposes a full patch...

avatar ReLater
ReLater - comment - 6 Mar 2020

When I have a menu title "The Tree - the best release ever" I want that "the best release ever" is translated but "The Tree" not.

Thus, I would use a plugin like EOR of Kubik Rubik, define 1 (if pregMatch skills) or 2 replacement rules. Soemthing like this:
[noT] => <span class=notranslate>
[/noT] => </span>

or similiar. Depends on which markup you prefer.

Then I write my title like this:
[noT]The Tree[/noT] - the best release ever

Advantage: I can use this code snippets wherever I want, also in editor text and so on. And it's more flexible.

And I can change the markup whenever I want inside the plugin if translators change again and again their proprietary rules.

Or if I only need the replacement for menu titles I add simple PHP in an override:
str_replace(['[noT]', '[/noT]'], ['<span class=notranslate>', '</span>'], $title);
and don't need the plugin.

avatar gerryfrancis
gerryfrancis - comment - 6 Mar 2020

@ReLater Nice approach, I did not know this, thanks a lot! :)

avatar ReLater
ReLater - comment - 6 Mar 2020

Thank Viktor Vogel (Kubik Rubik) for his ingenious little and bigger helpers! ;-)

avatar alikon
alikon - comment - 6 Mar 2020

so we can close this as there is a 3dp for this ?

avatar richard67
richard67 - comment - 6 Mar 2020

.. or an override without 3rd party if for the menu titles only

avatar mbabker
mbabker - comment - 6 Mar 2020

.. or an override without 3rd party if for the menu titles only

Only an option if you either want to apply it to all items consistently or maintain a ID list in the override of items it should apply to.

so we can close this as there is a 3dp for this ?

Just because an extension exists for a problem doesn't mean that core doesn't need to entertain the feature request. K2 and EasyBlog exist, can we remove com_content from core since a 3PD solution exists for content management? :trollface:

avatar infograf768
infograf768 - comment - 7 Mar 2020

If we do a patch, remains to decide which markup would be used.
class="notranslate" or translate="no", default being nothing.

avatar sanek4life
sanek4life - comment - 7 Mar 2020

translate="no"

Only this one. So recommends W3. But class="notranslate is an outdated version that will not be supported in the future.

avatar alikon
alikon - comment - 7 Mar 2020

i've made a draft #28261 it is not perfect but give feedback please

avatar alikon alikon - change - 9 Mar 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-03-09 08:09:28
Closed_By alikon
avatar alikon alikon - close - 9 Mar 2020
avatar alikon
alikon - comment - 9 Mar 2020

please test #28261

Add a Comment

Login with GitHub to post a comment