It was agreed that it's a bad practice to use flags for language icons.
I recommend against flag icons:
1. From a usability point of view, many languages reside in different countries
2. From an SEO Point of view, textual language links are better.
Textual links are much better.
The following changes are needed in i18n.module:
1. There should be an i18n setting option to hide the language icons, and only use the language name in the link. Preferably - use the translated language name, according to the current language.
2. Language name, inside the textual link, should be translated using t().
Until such a setting option exists, here is the code needed in order to hide the language icons in template.php in Drupal 4.7 and translate the language name in the language link. This was tested on my Jewish Clipart site, where you can see a demo.
Override the themable function theme_i18n_link(), defined in the i18n module.
To override it, add the following code to your template's template.php file.
function phptemplate_i18n_link($text, $target, $lang, $separator=' '){
$output = '<span class="i18n-link">';
$attributes = ($lang == i18n_get_lang()) ? array('class' => 'active') : NULL;
// $output .= l(theme('i18n_language_icon', $lang), $target, $attributes, NULL, NULL, FALSE, TRUE);
// $output .= $separator;
// $output .= l($text, $target, $attributes, NULL, NULL, FALSE, TRUE);
$output .= l(t($text), $target, $attributes, NULL, NULL, FALSE, TRUE);
$output .= '</span>';
return $output;
}
Amnon
-
Drupal Focused Search Engine | Drupal Israel | Web Hosting Strategies
Personal: Hitech Dolphin: Regain Simple Joy :)
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | i18n_noflags.patch | 1.97 KB | rssaddict |
Comments
Comment #1
alex_b commented+1 for languages as text.
Just to add some poster cases: Spanish flag: Spanish spoken throughout most of Latin America, Spain itself with bask, catalan etc. multilingual. English, German, Quechua (which flag?)...
Comment #2
rssaddict commentedIt would be fairly easy to make this an option on the settings page:
and change the theme_i18n_link function to take account of this:
So it would be up to the site admin to decide which format was preferred for the language switcher.
Comment #3
rssaddict commentedHere is a patch for 5.0 with the code I posted above. The default setting is text-only language links, and the language icon fieldset has been changed to collapsed by default.
Comment #4
rssaddict commentedComment #5
forgestik commentedSorry to bother you guys with such a simple question, but I just wanted to know. What do I need to do with this patch file exactly? I don't quite understand the + and - (preceeding each line).
Thanks
Comment #6
davemybes commentedHi again :)
Check out this page: http://drupal.org/node/60108 and maybe this one as well: http://drupal.org/diffandpatch. The - means that line has been deleted and the + means that line has been added. Position of these lines is critical, so pay attention to surrounding code if you intend to apply the patch manually (i.e. copy and paste the changes).
Comment #7
forgestik commentedHey (oh joy, my private Angel comming to my rescue once again ;-)
Look. I managed to get gnuwin32 to work. I planned to use it this way :
(from a cmd prompt under windows os)
This statement is getting recognize, the code runs, but gnuwin32 seems to complain about something.. Any thought? (kidding..)
Here's the error message returned by gnu : Can't find the file to patch at input line 5. Perhaps you used the wrong -p or --strip option? The text leading up to this was :
|-------------------------------
|Index : i18n.module
|==============
|--- i18n.module (revision 1)
|+++ i18n.module (working copy)
|-------------------------------
File to patch: _
I tried various things, such as running the patch somewhere else with only the patch file and the i18n.module file in one folder, but nothing would do. Gnu doesn't like me very much :(
Thanks a lot once again.
Charles
Comment #8
davemybes commentedI haven't use the gnuwin32 tools, so I'm not sure how they work exactly. I personally use UnxUtils and haven't had any problems, unless the patch is not done right.
Instead of a patch for this feature, I would recommend using the template.php code in the original post. This will save you having to redo the patch when i18n gets updated.
Comment #9
gagarine commentedOk flags is not a good option but in my case, I use the flags system to put icons (with the language code for exempale "fr" for français). This is a image but i put the language name in the "alt" attribut.
A them language switcher fonction where you can enabled (or disabled) what you want (text,language code, traduction,
flagsicons, ...) is better, no?Comment #10
botum commentedI'd like to add, that as I see it, the language name should not be translated in order to be understanded by "that" language reader in the case he needs it.
If I speak spanish and landed on an english page, I'd recognize Español rather than Spanish to get to my lang.
Comment #11
pkej commentedI'd like to add +1 as well.
Also, I think a drop down selection box option would be nice, since a list of languages sometimes doesn't vibe with the design of the site. A small globe icon in front of the box would probably give a good hint, then supply the list of languages as links in the head, including, of course, the correct lang= and title= tags.
Coupled with browser negotiation of language this would be a fairly straightforward way for many sites.
Comment #12
jose reyero commentedThis has been addressed in newer versions (5.x...)
No new features for 4.7 branch.
Comment #13
phifesoul74 commentedHow could i mod this snippet code to add .last and first .class to the menu list