<form class="form-horizontal">
    <div class="control-group" title="{{ _('Name of this OctoPrint instance, will be shown in the navigation bar and broadcast on the network') }}">
        <label class="control-label" for="settings-appearanceName">{{ _('Title') }}</label>
        <div class="controls">
            <input type="text" class="input-block-level" data-bind="value: appearance_name" id="settings-appearanceName">
        </div>
    </div>
    <div class="control-group" title="{{ _('Personalize the color of the navigation bar - maybe to match your printer?') }}">
        <label class="control-label" for="settings-appearanceColor">{{ _('Color') }}</label>
        <div class="controls">
            <select id="settings-appearanceColor" data-bind="value: appearance_color, options: appearance_available_colors, optionsText: 'name', optionsValue: 'key'">
            </select>
        </div>
    </div>
    <div class="control-group" title="{{ _('For acrylic printers ;)') }}">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_colorTransparent"> {{ _('Transparent Color') }}
            </label>
        </div>
    </div>
    <div class="control-group" title="">
        <label class="control-label" for="settings-appearanceLanguages">{{ _('Language Packs') }}</label>
        <div class="controls">
            <button class="btn" data-bind="click: showTranslationManager">{{ _('Manage...') }}</button>
        </div>
    </div>
    <div class="control-group" title="">
        <label class="control-label" for="settings-appearanceDefaultLanguage">{{ _('Default Language') }}</label>
        <div class="controls">
            <select id="settings-appearanceDefaultLanguage" data-bind="options: locales,
                                   optionsText: function(item) { return item.display + ((item.language != undefined && item.english != undefined) ? ' [' + item.language + ', ' + item.english + ']' : '') },
                                   optionsValue: 'language',
                                   value: appearance_defaultLanguage">
            </select>
            <span class="help-inline">{{ _('Changes to the default interface language will only become active after a reload of the page and only be active if not overridden by the user''s language settings.') }}</span>
        </div>
    </div>
</form>

<div id="settings_appearance_managelanguagesdialog" class="modal hide fade">
    <div class="modal-header">
        <a href="#" class="close" data-dismiss="modal" aria-hidden="true">&times;</a>
        <h3>{{ _('Manage Language Packs...') }}</h3>
    </div>
    <div class="modal-body">
        <h4>{{ _('Available Language Packs') }}</h4>

        <div data-bind="visible: languagePacksAvailable()">
            <div id="settings_appearance_managelanguagesdialog_list" data-bind="slimScrolledForeach: translations.paginatedItems" style="height: 300px">
                <div class="entry">
                    <strong><a href="#" onclick="$(this).children('i').toggleClass('icon-caret-right icon-caret-down').parent().parent().next().slideToggle('fast')"><i class="icon-caret-down"></i> <span data-bind="text: $root.languagePackDisplay($data)"></span></a></strong>
                    <div class="packs">
                        <!-- ko foreach: $data.packs -->
                        <div class="row-fluid">
                            <div class="span8 offset1">
                                <strong data-bind="text: display"></strong><br />
                                <small data-bind="visible: pack.last_update" class="muted">{{ _('Last update:') }} <span data-bind="text: formatDate($data.pack.last_update)"></span></small>
                            </div>
                            <div class="span3">
                                <button class="btn btn-block btn-small" data-bind="click: function() {$root.deleteLanguagePack($data.pack.locale, $data.identifier)}"><i class="icon-trash"></i> {{ _('Delete') }}</button>
                            </div>
                        </div>
                        <!-- /ko -->
                    </div>
                </div>
            </div>
        </div>
        <div id="settings_appearance_managelanguagesdialog_emptylist" data-bind="visible: !languagePacksAvailable()">
            <div>
                <p>
                    <strong>{{ _('No additional Language Packs are installed at the moment.') }}</strong>
                </p>
            </div>
        </div>

        <h4>{{ _('Upload additional Language Packs') }}</h4>

        <form class="form-inline">
            <div class="control-group row-fluid" data-bind="css: {error: invalidTranslationArchive}">
                <div class="input-prepend span9">
                    <span class="btn fileinput-button">
                        <span>{{ _('Browse...') }}</span>
                        <input id="settings_appearance_managelanguagesdialog_upload" type="file" name="file" data-url="{{ url_for("api.uploadLanguagePack") }}">
                    </span>
                    <span class="add-on add-on-limited text-left" data-bind="text: translationUploadFilename, attr: {title: translationUploadFilename}"></span>
                </div>
                <button id="settings_appearance_managelanguagesdialog_upload_start" class="btn btn-primary span3" data-bind="enable: enableTranslationUpload, css: {disabled: !enableTranslationUpload()}, click: function(){}">{{ _('Upload') }}</button>
            </div>
            <span class="help-block" data-bind="visible: invalidTranslationArchive">{{ _('This does not look like a valid language pack. Valid language packs should be either zip files or tarballs and have the extension ".zip", ".tar.gz", ".tgz" or ".tar"') }}</span>
        </form>

        <small>{{ _('Please note that you will have to reload the page in order for any newly added language packs to become available.') }}</small>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</button>
    </div>
</div>
