Any experience how Drupal is able to meet this requirement for text parts in another language then the node language:
"3.1.2 Language of Parts: The human language of each passage or phrase in the content can be programmatically determined except for proper names, technical terms, words of indeterminate language, and words or phrases that have become part of the vernacular of the immediately surrounding text. (Level AA)" http://www.w3.org/TR/WCAG20/#meaning-other-lang-id
The recommended solution is to use the lang-attribute.
What is the best practice to realise this in Drupal in WYSIWYG-editors. And harder, in node titles and in fields?
NB: Regarding WYSIWYG editors, it can be done with CKeditor and use the attribute button, but it's seems not userfriendly (users have to fill in the language code)?

Comments
language not always known
Unfortunately Drupal does not know the language of things specifically. Or better said when it does not know, it just assumes it is the site default language. For nodes, we have a master language. A node can be in multiple languages with entity translation, but we always load a specific language version, where all the field values should be in the same language. So in the end, you should be able to add language attributes in wrapper templates to these objects. Not sure if this was helpful or not.
Nodes & Blocks
Gabor, you know i18n in much more detail than I could every hope to, so please correct me if I'm oversimplifying this.
The fields, blocks & nodes are language aware and you can access them in the templates by:
In Core's system module html.tpl.php:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>>in Bartik's node.tpl.php filed level definitions are available:
$node->body['en']I can't recall if in D7 you need to hardcode the blocks in the settings.php
$conf['i18n_variables'][] = 'menu_block_5_parent';Everett wrote up the following a whole ago for us:
http://openconcept.ca/blog/everett/screenreaders_and_multilingual_commen...
Would certainly good to have this better documented. I suspect that most multi-lingual sites haven't also been thoroughly reviewed for accessibility, especially when the language can change within the page.
Certainly it is doable, but not easily.
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
nodes, fields yes, blocks no
There are many things in Drupal, where we don't know the language for sure, like blocks, menu items, etc. Drupal assumes those are all in the site default language, but that is merely an assumption.
People can of course use WYSIWYG editors (or those editors can be made to be used) for manual language tagging, it is just about adding wrappers with the right attributes after all :)
Thanks for these answers, on
Thanks for these answers, on a field level it should be doable.
But I was wondering about the requirement (in the Netherlands for governmental websites) to have the possibilty for editors to tag a part of a text (alinea, sentence or word) in the body in another language, for example a node with this text:
This paragraph is in English , but...Este apartado está en español.
Should be tagged like this:
<p lang="en-US">This paragraph is in English, but...</p><p lang="es">Este apartado está en español.</p>
It is an official requirement, but I never see websites that have implemented this and I am wondering if it actually makes sense (as the link above suggest that screenreaders don't interpret the language attribute in a text). The language tagging should be done manually by the content editors.
Code for standards, not for screen readers
Hanno, you bring up a great point that applies to more than just the proper tagging of phrases that are in a different language from that of the text around them: Do I code for what the standards say, or do I code for what screen readers support?
In this case especially, we need to code according to the standards and hope that the screen readers will eventually come around to supporting this feature. After all, if we don't and screen readers do eventually support this feature, then our content will be noncompliant. On the other hand, if we do and screen readers never support this feature, our content will not cause problems for anyone.
We should look more closely and decide whether we need to improve support for designating language attributes in Drupal's editing tools. Even though this feature is used less often than it is needed, it can be essential to making a passage accessible.
FYI in Typo3 it is
FYI in Typo3 it is implemented and explained here:
http://typo3.org/documentation/document-library/extension-manuals/rtehtm...
htmlArea RTE
I don't know enough about Typo3, but it looks like they have their own built in WYSIWYG editor from:
http://typo3.org/documentation/document-library/extension-manuals/rtehtm...
I don't know if it's in anyway related to the older htmlArea javascript tool or http://xinha.webfactional.com
I would think there would be some docs in this from http://tinymce.moxiecode.com or http://cksource.com but I didn't find them with a quick search.
There are so many modules available through the WYSIWYG module, should be possible to find one that allows you to define language of selected blocks of text from within the textarea.
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
@mgifford I didn't find any
@mgifford I didn't find any Drupal module handling this, but if you find one, please let me know. If not, it should be very doable to write a small module that provide an extra button for languages. It can provide an external Drupal plugin for the WYSISWYG module (in that way it will be a cross-editor plugin). The how-to is described in wysiwyg.api.php
@cliff You're right, but if depends also on the effort needed. We can check whether this accessibility requirement is under reconsideration or not.
This feature is most useful in the wysiwyg editors. I would suggest to postpone dealing with language codes in plain text fields (taxonomy, titles, filefield), will be less used, and definitely complicated.
Submitting a feature request
Have you submitted a feature request to http://drupal.org/project/issues/wysiwyg
I do think that you're on the right track here however. If you can set up a plugin for one of the javascript libraries out there (likely either tinymce or ckeditor) and then give people the choice to select which text in the body of your node is in which language.
In Canada government pages are either in english or french, there are almost no cases where another language would appear on the page unless it were either a comment or the language switcher itself.
I haven't looked at the language switcher, but will try to do that and get back.
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
I have just submitted an
I have just submitted an issue in the issue queue of the WYSIWYG module: http://drupal.org/node/1165466
Dutch website failed gov test because lack of language of parts
A local government website in the Netherlands made in Drupal failed this week accessibility acceptation by the governmental agency. One of the points is the lack of language of parts. See the report on http://www.accessibility.nl/toetsing/info/920 (Dutch, website breda.nl). So there is a real need to address integrating of the language of parts.
Is it possible to point us to the site?
We've been involved in setting up sites for the Government of Canada and would think that there would be similar accessibility requirements.
Perhaps it is more common to mix languages within a single page in the Netherlands. Anyways, interested in helping out if we can.
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
It's very common in the
It's very common in the Netherlands to have text parts in other languages. Examples are titles of books, movies, reports, speeches and scientific citations.
See the following examples of the official governmental portal rijksoverheid.nl (not Drupal, not correctly tagged - so it is an universal problem):
These are texts of speeches. The introduction is in Dutch, speech in english:
http://www.rijksoverheid.nl/documenten-en-publicaties/toespraken/2011/04...
http://www.rijksoverheid.nl/documenten-en-publicaties/toespraken/2008/01...
This is an attachment. The title is in english, the background information in Dutch:
http://www.rijksoverheid.nl/documenten-en-publicaties/rapporten/2011/02/...
English words in Dutch text:
http://www.rijksoverheid.nl/toegankelijkheid ("Return on Investment")
http://www.rijksoverheid.nl/onderwerpen/klimaatverandering/nieuws/2011/0... ("Level playing field")
Examples of the site breda.nl that was tested and should have language tags:
http://www.breda.nl/evenementen (name of the month in English)
http://www.breda.nl/evenementen/2011/2/4/beats-after-dinner-cafe-dos-ami... (english announcement)
http://www.breda.nl/nieuws/2011/05/19/live-in-the-living-zoekt-huiskamer... ("Live In The Living")
NB: An example of a correctly tagged page can be found here:
http://www.accessibility.nl/algemeen/publicaties/siteseeing
Interesting links
Thanks for posting those. Definitely a lot to think about in terms of variations.
It's interesting though that even this site has problems ensuring that this is consistently implemented in it's CMS:
https://www.accessibility.nl/algemeen/login
There are mixed languages here too.
This could well be a very interesting challenge for D8 and the multi-lingual initiative:
http://buytaert.net/multilingual-support-in-drupal-8
We could certainly use your help in getting this into D7 & D8!
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
Yeah, sometimes there is also
Yeah, sometimes there is also multilanguage 'by mistake'. Can happen in Drupal when there is no localisation string for a certain t() string. Sp, that would be yet another issue.
Edit: here is the issue: http://drupal.org/node/1165476
Language switching block
I just added this to the issue queue:
http://drupal.org/node/1164682
based on this thread. There are going to be other instances where language attributes are going to be needed, but hopefully we can find them & post them to this thread.
EDIT: 2 more
http://drupal.org/node/986156
http://drupal.org/node/1164926
--
OpenConcept | Twitter @mgifford | Drupal Security Guide
field in another language
If a whole field is in another language we could see if the module entity translation might be useful. It makes it possible to translate certain fields: http://drupal.org/project/entity_translation
Regarding the title in another language and language tag in the title (http://drupal.org/node/211475), that will be possible when the title becomes a field (see project http://drupal.org/project/title).
Edit: posted an issue in entity translation: http://drupal.org/node/1165806
meta issue
I created a meta-issue for Drupal 8 to implement this http://drupal.org/node/1323338