<form class="form-horizontal" onsubmit="return false;">
    <div class="control-group" title="{{ _('Name of this OctoPrint instance, will be shown in the navigation bar and broadcast on the network')|edq }}">
        <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?')|edq }}">
        <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 ;)')|edq }}">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_colorTransparent"> {{ _('Transparent color') }}
            </label>
        </div>
    </div>
    <div class="control-group" title="{{ _('Also personalize the icon of the browser tab')|edq }}">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_colorIcon"> {{ _('Colorize favicon (in supported browsers)') }}
            </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" id="settings-appearanceLanguages">{{ _('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>
    <div class="control-group">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_showFahrenheitAlso" id="settings-appearanceShowFahrenheitAlso"> {{ _('Show temperatures in Fahrenheit as well as Celsius') }}
            </label>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_fuzzyTimes" id="settings-appearanceFuzzyTimes"> {{ _('Show fuzzy print time estimates') }}
            </label>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_closeModalsWithClick" id="settings-appearanceCloseModalsWithClick"> {{ _('Close dialogs by clicking outside') }}
            </label>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <label class="checkbox">
                <input type="checkbox" data-bind="checked: appearance_showInternalFilename" id="settings-appearanceShowInternalFilename"> {{ _('Show internal filename in the files sidebar (if available)') }}
            </label>
        </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">
        <p>
            <strong>{{ _('There is currently no central repository for language packs like there is for plugins - any help to change that is appreciated!') }}</strong>
        </p>
        <p>
            {{ _('Until a repository is available, please see <a href="%(url)s" target="_blank" >the wiki</a> for language packs provided by the community.', url = "https://community.octoprint.org/t/translating-octoprint/21144") }}
        </p>

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

        <div data-bind="visible: languagePacksAvailable()">
            <div id="settings_appearance_managelanguagesdialog_list" data-bind="foreach: translations.paginatedItems">
                <div class="entry">
                    <strong><a href="#" class="fas" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.entry', container: '.packs' }"><i class="fas fa-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="far fa-trash-alt"></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" onsubmit="return false;">
            <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" accept=".zip,.tar.gz,.tgz,.tar" 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>
