(language, territory, errors)
| 12687 | // Set the UI locale for string collation |
| 12688 | ts.setUILocale(locale); |
| 12689 | function trySetLanguageAndTerritory(language, territory, errors) { |
| 12690 | var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); |
| 12691 | var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); |
| 12692 | var filePath = ts.combinePaths(containingDirectoryPath, language); |
| 12693 | if (territory) { |
| 12694 | filePath = filePath + "-" + territory; |
| 12695 | } |
| 12696 | filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); |
| 12697 | if (!sys.fileExists(filePath)) { |
| 12698 | return false; |
| 12699 | } |
| 12700 | // TODO: Add codePage support for readFile? |
| 12701 | var fileContents = ""; |
| 12702 | try { |
| 12703 | fileContents = sys.readFile(filePath); |
| 12704 | } |
| 12705 | catch (e) { |
| 12706 | if (errors) { |
| 12707 | errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); |
| 12708 | } |
| 12709 | return false; |
| 12710 | } |
| 12711 | try { |
| 12712 | // this is a global mutation (or live binding update)! |
| 12713 | ts.setLocalizedDiagnosticMessages(JSON.parse(fileContents)); |
| 12714 | } |
| 12715 | catch (_a) { |
| 12716 | if (errors) { |
| 12717 | errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); |
| 12718 | } |
| 12719 | return false; |
| 12720 | } |
| 12721 | return true; |
| 12722 | } |
| 12723 | } |
| 12724 | ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; |
| 12725 | function getOriginalNode(node, nodeTest) { |
no test coverage detected