<div id="g-user-language-block" class="g-block">
<h2>Language preference</h2>
<div class="g-block-content">
<select name="g-select-session-locale" >
<option value="">« ingen »</option>
<option value="da_DK">Dansk</option>
<option value="de_DE">Deutsch</option>
<option value="en_US">English (US)</option>
<option value="es_ES">Español</option>
<option value="fr_FR">Français</option>
<option value="no_NO" selected="selected">Norsk bokmål</option>
<option value="sv_SE">Svenska</option>
</select><script type="text/javascript">
$("select[name=g-select-session-locale]").change(function() {
var old_locale_preference = "no_NO";
var locale = $(this).val();
if (old_locale_preference == locale) {
return;
}
var expires = -1;
if (locale) {
expires = 365;
}
$.cookie("g_locale", locale, {"expires": expires, "path": "/"});
window.location.reload(true);
});
</script>
</div>
</div>
Posts: 32509
2 places:
for the drop-down list in the user settings:
modules/user/controllers/users.php
(generates the form's drop-down element)
for the language selection block:
modules/gallery/views/user_languages_block.html.php
which gets its data from modules/gallery/helpers/gallery_block.php
Posts: 573
Is it possible change the code so that users select language by clicking a flag (png) instead. Looks more impressive than the drop down. Maybe have the choise from admin to go for dropdown that fits in sidebar og flags horizontal inline.
Either way I would love to see div added to this block/content so that it can be positioned from css
If a flags are added then a generic div and an individual div would be nice css styling (margin, size, alignment etc)
I can get icons for this if you have time to create. It ranks high on my wishlist
all the best
HB - http://www.image.agentura.dk
Posts: 32509
flags would sure look nice. could be interesting to figure out how to incorporate this in kohana's form API (for the user preferences).
also, how would you deal with flags vs. countries / regions that have multiple popular / official languages?
(i'm sure that's a solved problem, just something to consider)
Posts: 573
I can not code this. I don't know Kohana or php for that sake. I can style it and contribute with icons
Concerning countries/regions I think to do straight forward for first release is fine. Limit to country (Languages already translated). Create a loop if else that accumulates the icon links and only ads activated languages. icon file name identical to the language name in G3, so that when a new language is registered, it will automatically look for mycountryflag.png if not there it substitues for a default grafic; flag coming ... once the flag ikon file is added to the module it's displayed.
This is what drupal did
http://drupal.org/project/modules?text=flag%20switch
However, I dissagree to the radiobuttons and the text. Clicking the icon should do it and looks nicer and maybe increase the chosen flag a bit. Alt text is fine for mouse over. This can also be used if the same flag represents more languages. Other than that as clean and simple as possible.
Should not display in a table but as floats in a grid. That way it can be themed inline horizontal, grid in block or vertical list. Therefore important to add the divs
all the best
HB - http://www.image.agentura.dk
Posts: 32509
Please add a feature request at http://sourceforge.net/apps/trac/gallery/newticket such that we don't lose track of this.
(please include a link back to this forum topic)
Thanks!
Posts: 573
I can not add feature requests. don't have access
all the best
HB - http://www.image.agentura.dk
Posts: 32509
everyone can file bugs / feature requests, all you need is a sourceforge.net account, and those are free. if you have an account with Gmail or any other OpenID provider, you can login with that at sourceforge.net as well.
Posts: 573
I think ticket is created:
https://sourceforge.net/apps/trac/gallery/ticket/1059
all the best
HB - http://www.image.agentura.dk
Posts: 32509
Thanks!
Posts: 573
Rwatcher wrote somewhere else:
If the coding is sorted out I will provide flags (freeicons) from the web. They will be .png transparent background. Note I can not get certain languages, people will have to be creative themselves. I just need to know what name they should have. The name displayed in admin > settings > languages may be the easiest. That way I can copy paste text for the signs I dont have or know. Is this the solution? or is it a locale code I need for file.
I will start collecting and renaming as soon I know what name you need
Stand alone module for sure so that it is not married to a theme. Remember divs for positioning and floats from css
all the best
HB - http://www.image.agentura.dk
Posts: 573
Flags are attached... files are 48x48px png transparent. Structure:
flags
- round
- rectangular
- custom
The idea is selection from admin wether to use round, rectangle or custom icons or stay with drop down. Only round icons are there for now.
Flagfiles are named in straight roman letters in lowercase as displayed in admin > settings > languages. Funny letters are left out, ex:
French = francais.png and not their funny c
Space is exchanged for underscore. Ex:
Norwegian = norsk_bokmal.png (and not thir funny å)
Variation of language ex Spanish:
espanol.png = spanish flag
espanol_ar.png = argentine flag
espanol_mx.png = mexico flag
I have no idea what these are and there flags are not yet included:
한국어
čeština
Euskara
Gaeilge
Lietuvių (flag is there, can someone confirm this is Lithuania)
Magyar
Slovenčina (flag is there, can someone confirm this is Slovenia)
Slovenščina (flag is there, can someone confirm this is Slovakia)
Tiếng Việt
العربية
فارس
עברית
Беларуск
български
Русский
українська
日本語
简体中文
繁體中文
all the best
HB - http://www.image.agentura.dk
Posts: 573
Besides round flags also rectangular are added in this zip. Same naming as above.
all files 48x48px transparent
I noticed someone messing with Faroe language. Not yet visible in admin>settings>language.
faroe.png added to round folder. Still looking for rectangular.
For default.png I added the European Union. 1 it's a simple flag 2 it has no language. Added for both round and rectangular
round files are around 6kb per icon
rectangular are around 2,4kb per icon
Still haven't sorted out the languages above
all the best
HB - http://www.image.agentura.dk
Posts: 573
Square icons added...
Folder structure:
flags
- custom
- rectangular
- round
- square
all the best
HB - http://www.image.agentura.dk
Posts: 716
Here is the initial version of the "Language Flags" module. This will replace the drop-down on the sidebar with click-able pictures of flags which have mouse-over text to display the language. There is also and Admin option (Settings -> Language flag settings) where you can select a flag shape.
The module is both here, and on my github account at:
http://github.com/rWatcher/gallery3-contrib/tree/master/modules/language_flags/
I've also set up a wiki page here:
http://codex.gallery2.org/Gallery3:Modules:language_flags
I re-named the pictures to use the locale codes. This way you can drop new flags into the images folder without needing php code to tell the module which image is which flag.
I dropped the default option from the module and set a special css id for the default flag instead. I think that makes more sense when using pictures instead of a drop-down?
Posts: 25965
This is great! Too bad that there is not a standard flag size.
Perhaps somebody will make a flag icon set that is the same size for all flags and a bit smaller than the ones supplied. Great job.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 573
This is brilliant - super work Rwatcher :-D lol - I will take a look at css
Where can I find the locale codes to use when adding more icons?
I will look at css to force downsize if required. I don't think icons should be smaller. Rather a bit larger and then downsized from css. Anyways - you always have the custom option to add your own icons.
rectangular
german flag missing
square
us flag missing
Please report if you find missing icons - languages - or flags mistaken for wrong language
all the best
HB - http://www.image.agentura.dk
Posts: 573
Rwatcher - could you add a class to all img tags, for resizing:
<img class="flag" src="whateveritis.png" />
If possible also class="select" for selected language replacing the other class. I can live without.
all the best
HB - http://www.image.agentura.dk
Posts: 573
Bug:
In your html output you use div: g-language_flag
in css you use: g-language-flag
Other divs look correct - I guess you want to change to g-language-flag for consistency
Forget about the class above... This will resize your icons
all the best
HB - http://www.image.agentura.dk
Posts: 573
Working Css for now
all the best
HB - http://www.image.agentura.dk
Posts: 573
This is the one to use:
- center flags horizontal within their container (vertical not working yet???)
- flags displayed as 40x40px selected as 48x48px
- margin between containers
- colors are left out = works across themes
Note: this code corrects the bug inside css mentioned above
demo: www.skunk.agentura.dk
I know looks funny, go to bottom of page
all the best
HB - http://www.image.agentura.dk
Posts: 573
For custom icon creation use locale codes:
http://download1.swsoft.com/Plesk/Plesk8.2/Doc/plesk-8.2-win-l10n-guide/39382.htm
idea for module - maybe ad the html code for this table in admin. That way you have the locale codes at hand
all the best
HB - http://www.image.agentura.dk
Posts: 573
Rwatcher - what I meant by default is that if png is not found, that flag could be substituted by default.png
I think by default you mean the default language G3 will start up
A lot of people will find missing files in new languages and also the ones that are not here yet. Looks ugly and meanwhile the EU flag substitutes the one missing until we get control of things. Just an idea.
all the best
HB - http://www.image.agentura.dk
Posts: 573
German flag rectangular added in this set....
Dave - all icons are same size 48x48px
all the best
HB - http://www.image.agentura.dk
Posts: 25965
Here is a nice set of smaller flags that are open source:
http://famfamfam.com/lab/icons/flags/
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 716
If you go to Admin -> Settings -> Languages and select "view source" you can see the locale codes as the form value for each language.
Sure, done. I also added a class for the "default" flag.
Good catch
Fixed.
Cool, modified CSS imported into the module. I also adjusted it for the div id bug fix.
I'll have to see if I can figure out where Gallery stores those at.
Done, "default.png" will be used when the correct flag doesn't exist.
Imported into the module, thanks
Posts: 573
further additions in this set (r=round, re=rectangular, s=square)
Basque eu_ES: r, re, sq (Spanish flag, no offence - don't know this flag)
Belarus be_BY: r, re, sq
Bulgaria bg_BG: r, re, sq
Catalan ca_ES: r, re, sq (Spanish flag, no offence - don't know this flag)
Check/Tjek cs_CZ: r, re, sq
Gaelic ga_IE: r, re, sq (??Irish flag??)
Israel he_IL: r, re, sq
Hungary hu_HU: r, re, sq
Iran fa_IR: r, re. sq
Japanese ja_JP: r, re, sq
Korea ko_KR: r, re, sq
Russian ru_RU: r, re, sq
Saudi Arab ar_SA: r, re, sq
Simplified Chinese zh_CN: r, re, sq
Slovakia sk_SK: r, re, sq (corrected)
Slovenia sl_SI: r, re, sq (corrected)
Traditional Chinese zh_TW: r, re, sq
Ukraine uk_UA: r, re, sq
Vietnamese vi_VN: r, re, sq
all the best
HB - http://www.image.agentura.dk
Posts: 573
tried to attach all compiled but exceeds 1mb - more the upload limit !!! How can we solve that, so that everything is here for download...
IMHO - truly beautiful module this one. Great visual lift
all the best
HB - http://www.image.agentura.dk
Posts: 716
You could split it up and do a separate .zip for each flag style. Plus I've been sticking everything up on github so the whole thing can be downloaded from there.
The "round" folder has an "sl_SI.png" and an "sl-SI.png", is that intentional?
Posts: 573
As long as everything is downloadable all together its fine. Flags still fit within 750 k. I guess in future I will only post newly added flags.
This is a mistake and you can remove sl-SI.png, I switched Slovenia and Slovakia in the process, and had to switch back. Kind of got lost I guess - Please report any faulty filenames or mistaken flags, so that we can have a sorted out module.
There may be missing files for one flagtype, that is available for another. missing files are substituted with the EU flag as described above.
all the best
HB - http://www.image.agentura.dk
Posts: 573
Icon Samples
Round: Faroe Islands

Rectangular: Mexico

Square: Japan

all the best
HB - http://www.image.agentura.dk
Posts: 573
Rwatcher:
This module use full url to icons. If you use relative the path will whereever the code pops up. ex...
/index.php/modules/language_flags/images/round/da_DK.png
I was thinking of adding the block a funny place. In this case I need to edit links and probably overwrite next time I upgrade. Others might get the same idea. just wanted to mention.
all the best
HB - http://www.image.agentura.dk
Posts: 716
URL's are generated via Gallery's url::base function. This way, if a person is using mod_rewrite to hide index.php (or doing anything else that would mess with the default url), the module will still generate the correct URLs for the flags.
Is there some reason why a full URL wouldn't work? I would think a relative path would be more likely to cause problems when moving the block around or using mod_rewrite.
Posts: 573
adding "/" before "index.php/anypath" as displayed above, will always force the link to start out from root in the same site it is in. So this type of relative always works.
Auto Generated, then don't worry. I thought of copying the block to display somewhere else. Not sure how to call, but I can copy code. That mess up links unless they are set as described. Never mind
all the best
HB - http://www.image.agentura.dk
Posts: 11
The img tags (in user_languages_block.html.php) that display the flag pictures miss the end tag '/' to be XHTML 1.0 Transitional.
Posts: 716
Fixed, thanks
Posts: 5
There's a double bracket in this CSS code, causing all CSS proceeding this code to not load in most browsers. Could you fix this?
Posts: 57
nice thanks
edit: not nice. it messes up my calendar
to bad
Posts: 716
So it should look like this? Assuming that's right, this fixes it.
It seems to work fine with the calendarview module. Or are you referring to something else?
Posts: 5
Yes, that's way better. Thanks for the update.
Posts: 5
It seems the css still has some flaws, because of the floating of the flags. Because of this, the wrapper div around the flags doesn't grow with the flags. I revised the css-file in a way that floating is unnecessary. The updated css-file is attached to this post.
P.S. Could you please increase the version number by one in the 'module.info' file on each update?
Posts: 716
Okay, CSS changed again, thanks
I don't increase the version number because doing so causes Gallery to alert you that your modules are out of date, and forces you to go through the updater screen even though there's nothing that needs to be updated. Unless I need the module to create a new table, or set up some new module variables, I tend to leave the version number alone.
Posts: 5
Thanks again!
Ok, but the downside of that decision is that the module updater won't notice the fix. Although, these css-fixes are quite important, because the original css messed with other modules. And it's also not possible to see whether you're running the latest and greatest version of the module, by checking the module screen.
Posts: 417
Found an error:
In language flags module, an EU flag is used instead of CZ flag http://en.wikipedia.org/wiki/File:Flag_of_the_Czech_Republic.svg
SoosKriszta
Csillamvilag.com
Bodypainting, Facepainting, Glitter, Henna
Materials, Courses, Resources
Posts: 573
Soos
If you read further up, you will see that the module selects the EU flag if an icon set is not found for your language. As you will also see above the Czech flag was added for both round, rectangular and square icons. So you should be fine. This makes me wonder though if you have the latest Icon set for this module. Could you check inside your folder structure if the Czeck icons are there?
all the best
HB - http://www.skunk.agentura.dk
Posts: 417
Sorry, should have read before posting. Maybe I am running an old version of the module and need to update
SoosKriszta
Csillamvilag.com
Bodypainting, Facepainting, Glitter, Henna
Materials, Courses, Resources
Posts: 417
I overwrote the module with the latest package available from gallerymodules.com, but still the EU flag is shown where CZ flag should be!
SoosKriszta
Csillamvilag.com
Bodypainting, Facepainting, Glitter, Henna
Materials, Courses, Resources
Posts: 573
Which flag set did you select?
You are right, a czeck flag was misplaced. The rectangular is placed inside the square folder and therefore not displayed if you select rectangular icons. Th EU icon is selected instead.
1) Inside square folder - look for: ca_CZ.png and move this file to rectangular folder
2) Correct the filename to be: cs-CZ.png
3) Try to select round and square flags just to be sure they work correctly for Czeck
4) Go back to rectangular if this is what you prefer
5) Let us know if this works for you
I will provide a correct icon set later, but busy renovating my appartment ...
all the best
HB - http://www.skunk.agentura.dk
Posts: 573
Czeck rectangular attached here:
all the best
HB - http://www.skunk.agentura.dk
Posts: 573
Entire updated icon set.
Unzip and dump it inside language_flags folder
! Czeck rectangular icon is added in this set
all the best
HB - http://www.skunk.agentura.dk
Posts: 417
Will do. Thanks!
SoosKriszta
Csillamvilag.com
Bodypainting, Facepainting, Glitter, Henna
Materials, Courses, Resources