django-admin-interface icon indicating copy to clipboard operation
django-admin-interface copied to clipboard

Language chooser style

Open saymoncoppi opened this issue 4 years ago • 6 comments

Hello Fabio! Could you gimme a tip about how to overwrite the language_chooser.html (venv\lib\python3.6\site-packages\admin_interface\templates\admin_interface\language_chooser.html) and keep it this way below?

image

I made these changes, but how to persist in a new enviroment? Manually again?

<select name="language" onchange="document.getElementById(String('language-chooser-hidden-form-' + this.value)).submit();" 
style="width:65px;margin-top:-9px;font-size:11px;font-weight:300;color:#cfcfcf;border:0px;outline:0px;">

Tks buddy!!!

saymoncoppi avatar Nov 11 '21 04:11 saymoncoppi

Should I update the admin-interface.css and run python manage.py collectstatic again?

.admin-interface .language-chooser {
    display: inline-block;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    width:65px;
    margin-top:-9px;
    font-size:11px;
    font-weight:300;
    color:#cfcfcf;
    border:0px;
    outline:0px;
}

saymoncoppi avatar Nov 11 '21 04:11 saymoncoppi

@saymoncoppi basically you need to customise the language-chooser css, I think the only thing you can do to persist changes is to override the template from you own application adding a templates/admin_interface/language_chooser.html file and injecting the css inside it, this file will override the admin_interface one.

Just for curiosity, why you need to change the language-chooser style? Maybe that an option to see it with a minimal style could be added.

fabiocaccamo avatar Nov 11 '21 09:11 fabiocaccamo

Hello Fabio! Since I'm using a minimalist style on the admin_interface theme, removing borders and adjusting the font size/color it fits better to me. Also maybe it is better for more people that prefer a non-distraction element at the top :)

Your idea about templates is the right way to do it. LOL Sorry for my newbie question.

Ahhh! Another suggestion to new versions of admin interface on language_chooser:

  • Inline option for languages
  • no borders for dropdown
  • country flags option (only flags or beside language)

Reference for flags:

One more time!

Tks for your great job!!!

saymoncoppi avatar Nov 11 '21 12:11 saymoncoppi

Please don’t use country flags to represent languages: http://www.flagsarenotlanguages.com/blog/why-flags-do-not-represent-language/

merwok avatar Nov 11 '21 16:11 merwok

G

Please don’t use country flags to represent languages: http://www.flagsarenotlanguages.com/blog/why-flags-do-not-represent-language/

Great point! Tks for sharing... @fabiocaccamo discard the flags idea :)

saymoncoppi avatar Nov 11 '21 17:11 saymoncoppi

@saymoncoppi I would add an option named language_chooser_style / language_chooser_widget with 3 options:

  • Default Select - the current one
  • Minimal Select - the suggested one, requires just a dynamic css class
  • Inline Menu - this is a completely different widget and it needs a bit of work because setting the language requires interaction with the hidden form, check: templates/admin_interface/language-chooser.html

fabiocaccamo avatar Nov 23 '21 21:11 fabiocaccamo

@saymoncoppi added support to custom language chooser style in 0.21.0 version.

If you need a style that is not supported you must override the template: templates/admin_interface/language-chooser.html.

fabiocaccamo avatar Oct 06 '22 15:10 fabiocaccamo