Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Map filename to language in case of dotfiles #11560

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions src/editor/EditorStatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,16 @@ define(function (require, exports, module) {

languageSelect = new DropdownButton("", [], function (item, index) {
var document = EditorManager.getActiveEditor().document,
defaultLang = LanguageManager.getLanguageForPath(document.file.fullPath, true);
defaultLang = LanguageManager.getLanguageForPath(document.file.fullPath, true),
fileExtension = LanguageManager.getCompoundFileExtension(document.file.fullPath),
fileName = null;

if (fileExtension === "") {
fileName = document.file._name;
}

if (item === LANGUAGE_SET_AS_DEFAULT) {
var label = _.escape(StringUtils.format(Strings.STATUSBAR_SET_DEFAULT_LANG, LanguageManager.getCompoundFileExtension(document.file.fullPath)));
var label = _.escape(StringUtils.format(Strings.STATUSBAR_SET_DEFAULT_LANG, fileName || "." + fileExtension));
return { html: label, enabled: document.getLanguage() !== defaultLang };
}

Expand Down Expand Up @@ -379,14 +385,21 @@ define(function (require, exports, module) {
// Language select change handler
languageSelect.on("select", function (e, lang) {
var document = EditorManager.getActiveEditor().document,
fullPath = document.file.fullPath;
fullPath = document.file.fullPath,
fileExtension = LanguageManager.getCompoundFileExtension(fullPath);

if (lang === LANGUAGE_SET_AS_DEFAULT) {
// Set file's current language in preferences as a file extension override (only enabled if not default already)
var fileExtensionMap = PreferencesManager.get("language.fileExtensions");
fileExtensionMap[LanguageManager.getCompoundFileExtension(fullPath)] = document.getLanguage().getId();
PreferencesManager.set("language.fileExtensions", fileExtensionMap);

if (fileExtension === "") {
var fileNameMap = PreferencesManager.get("language.fileNames"),
fileName = document.file._name;
fileNameMap[fileName] = document.getLanguage().getId();
PreferencesManager.set("language.fileNames", fileNameMap);
} else {
// Set file's current language in preferences as a file extension override (only enabled if not default already)
var fileExtensionMap = PreferencesManager.get("language.fileExtensions");
fileExtensionMap[fileExtension] = document.getLanguage().getId();
PreferencesManager.set("language.fileExtensions", fileExtensionMap);
}
} else {
// Set selected language as a path override for just this one file (not persisted)
var defaultLang = LanguageManager.getLanguageForPath(fullPath, true);
Expand Down
2 changes: 1 addition & 1 deletion src/nls/cs/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Klikněte pro změnu typu souboru",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Klikněte pro zapnutí panelu zpráv.",
"STATUSBAR_DEFAULT_LANG" : "(výchozí)",
"STATUSBAR_SET_DEFAULT_LANG" : "Nastavit jako výchozí pro .{0} soubory",
"STATUSBAR_SET_DEFAULT_LANG" : "Nastavit jako výchozí pro {0} soubory",

// CodeInspection: chyby/varování
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} chyb",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/de/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Klicken, um den Dateityp zu ändern",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Klicken, um Übersicht anzuzeigen/auszublenden.",
"STATUSBAR_DEFAULT_LANG" : "(Standard)",
"STATUSBAR_SET_DEFAULT_LANG" : "Als Standard für .{0}-Dateien festlegen",
"STATUSBAR_SET_DEFAULT_LANG" : "Als Standard für {0}-Dateien festlegen",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} Probleme",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/es/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Haz clic para cambiar el tipo de archivo",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Haz clic para mostrar/ocultar el panel de reportes.",
"STATUSBAR_DEFAULT_LANG" : "(por defecto)",
"STATUSBAR_SET_DEFAULT_LANG" : "Marcar como predeterminado para los archivos .{0}",
"STATUSBAR_SET_DEFAULT_LANG" : "Marcar como predeterminado para los archivos {0}",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "Problemas de {0}",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/fa-ir/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "جهت تغییر نوع پرونده، کلیک کنید.",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. باز و بسته کردن پنل گزارشات.",
"STATUSBAR_DEFAULT_LANG" : "(پیش فرض)",
"STATUSBAR_SET_DEFAULT_LANG" : " اعمال بعنوان پیش فرض برای .{0} پرونده ها",
"STATUSBAR_SET_DEFAULT_LANG" : " اعمال بعنوان پیش فرض برای {0} پرونده ها",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : " {0} خطا",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/fi/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Vaihda tiedostotyyppiä napsauttamalla",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Näytä tai piilota raporttipaneeli napsauttamalla.",
"STATUSBAR_DEFAULT_LANG" : "(oletus)",
"STATUSBAR_SET_DEFAULT_LANG" : "Aseta oletukseksi .{0}-tiedostoille",
"STATUSBAR_SET_DEFAULT_LANG" : "Aseta oletukseksi {0}-tiedostoille",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} ongelmaa",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/fr/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP": "Cliquez pour modifier le type de fichier",
"STATUSBAR_CODE_INSPECTION_TOOLTIP": "{0}. Cliquez pour afficher/masquer le panneau des rapports.",
"STATUSBAR_DEFAULT_LANG": "(par défaut)",
"STATUSBAR_SET_DEFAULT_LANG": "Utiliser par défaut pour les fichiers .{0}",
"STATUSBAR_SET_DEFAULT_LANG": "Utiliser par défaut pour les fichiers {0}",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE": "{0} problèmes",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/gl/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Fai click para cambiar o tipo de arquivo",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Fai click para amosar/ocultar o panel de reportes.",
"STATUSBAR_DEFAULT_LANG" : "(por defecto)",
"STATUSBAR_SET_DEFAULT_LANG" : "Marcar como predeterminado para os arquivos .{0}",
"STATUSBAR_SET_DEFAULT_LANG" : "Marcar como predeterminado para os arquivos {0}",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "Problemas de {0}",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/id/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Klik untuk mengubah tipe file",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Klik untuk menampilkan/menyembunyikan panel laporan.",
"STATUSBAR_DEFAULT_LANG" : "(default)",
"STATUSBAR_SET_DEFAULT_LANG" : "Simpan sebagai Default untuk File .{0}",
"STATUSBAR_SET_DEFAULT_LANG" : "Simpan sebagai Default untuk File {0}",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} Masalah",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/it/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Clicca per cambiare il tipo di file",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Clicca per attivare pannello dei report.",
"STATUSBAR_DEFAULT_LANG" : "(default)",
"STATUSBAR_SET_DEFAULT_LANG" : "Imposta come predefinito per .{0} File",
"STATUSBAR_SET_DEFAULT_LANG" : "Imposta come predefinito per {0} File",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} Problemi",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/ja/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP": "クリックしてファイルタイプを変更",
"STATUSBAR_CODE_INSPECTION_TOOLTIP": "{0}。クリックしてレポートパネルを切り替えます。",
"STATUSBAR_DEFAULT_LANG": "(指定なし)",
"STATUSBAR_SET_DEFAULT_LANG": ".{0} ファイルのデフォルトとして設定",
"STATUSBAR_SET_DEFAULT_LANG": "{0} ファイルのデフォルトとして設定",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE": "{0} 個の問題",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/ko/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "파일 종류를 변경하려면 클릭하세요",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. 클릭하면 기록 패널을 토글합니다.",
"STATUSBAR_DEFAULT_LANG" : "(기본값)",
"STATUSBAR_SET_DEFAULT_LANG" : ".{0} 파일에 대한 기본값으로 설정",
"STATUSBAR_SET_DEFAULT_LANG" : "{0} 파일에 대한 기본값으로 설정",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0}개의 에러",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/nl/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Klik om bestandstype te veranderen.",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Klik om foutenpaneel te openen.",
"STATUSBAR_DEFAULT_LANG" : "(default)",
"STATUSBAR_SET_DEFAULT_LANG" : "Standaard voor .{0} bestanden",
"STATUSBAR_SET_DEFAULT_LANG" : "Standaard voor {0} bestanden",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} Fouten",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/pt-br/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Clique para alterar o tipo de arquivo",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Clique para abrir/fechar o painel de relatórios.",
"STATUSBAR_DEFAULT_LANG" : "(padrão)",
"STATUSBAR_SET_DEFAULT_LANG" : "Definir como padrão para arquivos .{0}.",
"STATUSBAR_SET_DEFAULT_LANG" : "Definir como padrão para arquivos {0}.",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "Problemas de {0}",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/ro/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Clic pentru a modifica tipul fișierului",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Clic pentru a arăta / ascunde panoul de rapoarte.",
"STATUSBAR_DEFAULT_LANG" : "(implicit)",
"STATUSBAR_SET_DEFAULT_LANG" : "Setează ca implicit pentru fișierele .{0}",
"STATUSBAR_SET_DEFAULT_LANG" : "Setează ca implicit pentru fișierele {0}",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} probleme",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Click to change file type",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Click to toggle report panel.",
"STATUSBAR_DEFAULT_LANG" : "(default)",
"STATUSBAR_SET_DEFAULT_LANG" : "Set as Default for .{0} Files",
"STATUSBAR_SET_DEFAULT_LANG" : "Set as Default for {0} Files",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} Problems",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/sr/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Кликни за измену типа датотеке",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Кликни за приказ/скривање панела са извештајима.",
"STATUSBAR_DEFAULT_LANG" : "(подразумевано)",
"STATUSBAR_SET_DEFAULT_LANG" : "Подеси као \"подразумевано\" за .{0} датотеке",
"STATUSBAR_SET_DEFAULT_LANG" : "Подеси као \"подразумевано\" за {0} датотеке",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} грешака",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/sv/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Klicka för att byta filtyp",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Klicka för att visa rapportpanel.",
"STATUSBAR_DEFAULT_LANG" : "(standard)",
"STATUSBAR_SET_DEFAULT_LANG" : "Ställ in som standard för .{0}-filer",
"STATUSBAR_SET_DEFAULT_LANG" : "Ställ in som standard för {0}-filer",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} fel",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/uk/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "Натисніть, аби змінити тип файлу",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}. Натисніть, аби перемкнути панель повідомлень.",
"STATUSBAR_DEFAULT_LANG" : "(типово)",
"STATUSBAR_SET_DEFAULT_LANG" : "Встановити типовим для файлів .{0}",
"STATUSBAR_SET_DEFAULT_LANG" : "Встановити типовим для файлів {0}",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} Помилок",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/zh-cn/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "点击更改文件类型",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}。点击打开关闭报告面板",
"STATUSBAR_DEFAULT_LANG" : "(默认)",
"STATUSBAR_SET_DEFAULT_LANG" : "设置为 .{0} 的缺省",
"STATUSBAR_SET_DEFAULT_LANG" : "设置为 {0} 的缺省",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} 问题",
Expand Down
2 changes: 1 addition & 1 deletion src/nls/zh-tw/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ define({
"STATUSBAR_LANG_TOOLTIP" : "按一下可以變更檔案類型",
"STATUSBAR_CODE_INSPECTION_TOOLTIP" : "{0}。按一下可以開啟或關閉報告面板。",
"STATUSBAR_DEFAULT_LANG" : "(預設)",
"STATUSBAR_SET_DEFAULT_LANG" : "設定成 .{0} 檔的預設值",
"STATUSBAR_SET_DEFAULT_LANG" : "設定成 {0} 檔的預設值",

// CodeInspection: errors/warnings
"ERRORS_PANEL_TITLE_MULTIPLE" : "{0} 項問題",
Expand Down