From 0d2e0986808e864b7c070b9791d01bd469946373 Mon Sep 17 00:00:00 2001 From: Amin Ullah Khan Date: Fri, 7 Aug 2015 04:40:16 -0700 Subject: [PATCH] Map filename to language in case of dotfile --- src/editor/EditorStatusBar.js | 29 +++++++++++++++++++++-------- src/nls/cs/strings.js | 2 +- src/nls/de/strings.js | 2 +- src/nls/es/strings.js | 2 +- src/nls/fa-ir/strings.js | 2 +- src/nls/fi/strings.js | 2 +- src/nls/fr/strings.js | 2 +- src/nls/gl/strings.js | 2 +- src/nls/id/strings.js | 2 +- src/nls/it/strings.js | 2 +- src/nls/ja/strings.js | 2 +- src/nls/ko/strings.js | 2 +- src/nls/nl/strings.js | 2 +- src/nls/pt-br/strings.js | 2 +- src/nls/ro/strings.js | 2 +- src/nls/root/strings.js | 2 +- src/nls/sr/strings.js | 2 +- src/nls/sv/strings.js | 2 +- src/nls/uk/strings.js | 2 +- src/nls/zh-cn/strings.js | 2 +- src/nls/zh-tw/strings.js | 2 +- 21 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/editor/EditorStatusBar.js b/src/editor/EditorStatusBar.js index 1998c5466e5..64cdbc98a6e 100644 --- a/src/editor/EditorStatusBar.js +++ b/src/editor/EditorStatusBar.js @@ -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 }; } @@ -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); diff --git a/src/nls/cs/strings.js b/src/nls/cs/strings.js index 2e5f96d3cf0..36ca3690732 100644 --- a/src/nls/cs/strings.js +++ b/src/nls/cs/strings.js @@ -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", diff --git a/src/nls/de/strings.js b/src/nls/de/strings.js index 199ce51f7bb..4aea623ba5e 100644 --- a/src/nls/de/strings.js +++ b/src/nls/de/strings.js @@ -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", diff --git a/src/nls/es/strings.js b/src/nls/es/strings.js index 596550be642..2f88bc615c5 100644 --- a/src/nls/es/strings.js +++ b/src/nls/es/strings.js @@ -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}", diff --git a/src/nls/fa-ir/strings.js b/src/nls/fa-ir/strings.js index f2c1469e788..4dff93e64af 100644 --- a/src/nls/fa-ir/strings.js +++ b/src/nls/fa-ir/strings.js @@ -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} خطا", diff --git a/src/nls/fi/strings.js b/src/nls/fi/strings.js index f5b7d8f8730..ffb7e51a7ef 100644 --- a/src/nls/fi/strings.js +++ b/src/nls/fi/strings.js @@ -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", diff --git a/src/nls/fr/strings.js b/src/nls/fr/strings.js index eec02173e6c..7f49e432697 100644 --- a/src/nls/fr/strings.js +++ b/src/nls/fr/strings.js @@ -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", diff --git a/src/nls/gl/strings.js b/src/nls/gl/strings.js index 3fc4e7f9bd0..23869a956df 100644 --- a/src/nls/gl/strings.js +++ b/src/nls/gl/strings.js @@ -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}", diff --git a/src/nls/id/strings.js b/src/nls/id/strings.js index cbb3badc8fe..ed8686fabc2 100644 --- a/src/nls/id/strings.js +++ b/src/nls/id/strings.js @@ -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", diff --git a/src/nls/it/strings.js b/src/nls/it/strings.js index f01555aa65b..8786f0a10d1 100644 --- a/src/nls/it/strings.js +++ b/src/nls/it/strings.js @@ -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", diff --git a/src/nls/ja/strings.js b/src/nls/ja/strings.js index 26512dbaf06..bbd238c32ce 100644 --- a/src/nls/ja/strings.js +++ b/src/nls/ja/strings.js @@ -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} 個の問題", diff --git a/src/nls/ko/strings.js b/src/nls/ko/strings.js index 4f1692e5ae2..66500fb908e 100644 --- a/src/nls/ko/strings.js +++ b/src/nls/ko/strings.js @@ -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}개의 에러", diff --git a/src/nls/nl/strings.js b/src/nls/nl/strings.js index f9856c8a8a9..5db8aec1c6c 100644 --- a/src/nls/nl/strings.js +++ b/src/nls/nl/strings.js @@ -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", diff --git a/src/nls/pt-br/strings.js b/src/nls/pt-br/strings.js index 3c8f28e4cea..551875df1fe 100644 --- a/src/nls/pt-br/strings.js +++ b/src/nls/pt-br/strings.js @@ -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}", diff --git a/src/nls/ro/strings.js b/src/nls/ro/strings.js index 0bacdf20fc9..3b47e3d087c 100644 --- a/src/nls/ro/strings.js +++ b/src/nls/ro/strings.js @@ -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", diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index fde5c87db52..8b650e10d84 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -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", diff --git a/src/nls/sr/strings.js b/src/nls/sr/strings.js index 26a68a0663e..ecbdac9640a 100644 --- a/src/nls/sr/strings.js +++ b/src/nls/sr/strings.js @@ -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} грешака", diff --git a/src/nls/sv/strings.js b/src/nls/sv/strings.js index 8c102b63e80..534dbe0f499 100644 --- a/src/nls/sv/strings.js +++ b/src/nls/sv/strings.js @@ -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", diff --git a/src/nls/uk/strings.js b/src/nls/uk/strings.js index 56ee4bbf006..106c607cf01 100644 --- a/src/nls/uk/strings.js +++ b/src/nls/uk/strings.js @@ -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} Помилок", diff --git a/src/nls/zh-cn/strings.js b/src/nls/zh-cn/strings.js index b50edec74c1..f2f5496e6c3 100644 --- a/src/nls/zh-cn/strings.js +++ b/src/nls/zh-cn/strings.js @@ -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} 问题", diff --git a/src/nls/zh-tw/strings.js b/src/nls/zh-tw/strings.js index 4e68ef1d775..77803a8b39b 100644 --- a/src/nls/zh-tw/strings.js +++ b/src/nls/zh-tw/strings.js @@ -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} 項問題",