Adding Flag Icons

Topics: Feature requests, General
Jun 26, 2011 at 10:33 PM

In addition it would be great to add the ability to upload an Icon for each language to be displayed in the Drop Down... This could be used for Country Flags...

Coordinator
Jun 27, 2011 at 1:03 PM

Thanks for your contribution! I will think about it.

Dec 31, 2011 at 2:22 AM

Hello!

Can you please tell me how to change the «DropDownList» icon on the flags.

Coordinator
Dec 31, 2011 at 6:44 PM
Vite wrote:

Hello!

Can you please tell me how to change the «DropDownList» icon on the flags.

Hi,

You can define an Alternate view for the Culture Picker widget.

I highy recommend using a Shape Tracing tool for exploring default view's templates and creating Alternates.

Jan 2, 2012 at 1:15 AM
Edited Jan 2, 2012 at 1:51 AM

Hello!

Could you explain what I need to change in the template CulturePicker.cshtml

@using Orchard.Utility.Extensions

@using System.Collections.Generic

@using System.Globalization

 

@{

    var availableCultures = Model.AvailableCultures as List<string>;

 

    var availableCultureswithNames = new List<KeyValuePair<string, string>>(availableCultures.Count);

    foreach (var culture in availableCultures) {

        try {

            var cultureInfo = new CultureInfo(culture);

            availableCultureswithNames.Add(new KeyValuePair<string, string>(culture, cultureInfo.NativeName));

        }

        catch {

            availableCultureswithNames.Add(new KeyValuePair<string, string>(culture, culture));

        }

    }

}

 @using (Html.BeginForm("ChangeCulture", "UserCulture", new { Area = "Orchard.CulturePicker" })) {

    <div class="changeCulture">

        @*<label for="CultureName">@T("Language")</label>*@

        @Html.DropDownList("CultureName", new SelectList(availableCultureswithNames, "Key", "Value", Model.UserCulture), new { onchange = "submit()" })

    </div>

}

I think you need to replace the method Html.DropDownList ().

If, you do not have too much trouble, tell me, as I correctly modify the template CulturePicker.cshtml

Coordinator
Jan 2, 2012 at 7:21 AM
Edited Jan 2, 2012 at 7:22 AM

Please, take a look at this discussion: http://orchardculturepicker.codeplex.com/discussions/252712 .

There is an example provided how to replace a dropdown with a list of links. You can simply add some logic for displaying flag icons as well.