Skip to content

Commit

Permalink
feat: settings reorder (#163)
Browse files Browse the repository at this point in the history
* feat: settings reorder

* translations mismatch error

* fixes
  • Loading branch information
yevheniyJ authored Feb 19, 2024
1 parent f251601 commit ad00af7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,33 @@
{
"title": "Crowdin",
"properties": {
"crowdin.autoRefresh": {
"crowdin.useGitBranch": {
"type": "boolean",
"default": "true",
"description": "Enables or disables auto refresh after each change in Crowdin configuration file.",
"scope": "window"
"default": "false",
"description": "Use a Git branch as a Crowdin branch",
"scope": "window",
"order": 0
},
"crowdin.stringsCompletion": {
"type": "boolean",
"default": "true",
"description": "Enables or disables auto completion of strings keys.",
"scope": "window"
"scope": "window",
"order": 1
},
"crowdin.stringsCompletionFileExtensions": {
"type": "string",
"default": "*",
"description": "Comma-separated list of file extensions for which autocomplete should be active. By default strings autocomplete will be active in all files.",
"scope": "window"
"scope": "window",
"order": 2
},
"crowdin.useGitBranch": {
"crowdin.autoRefresh": {
"type": "boolean",
"default": "false",
"description": "Use a Git branch as a Crowdin branch",
"scope": "window"
"default": "true",
"description": "Enables or disables auto refresh after each change in Crowdin configuration file.",
"scope": "window",
"order": 3
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions src/client/crowdinClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@ export class CrowdinClient {
return translationFilesToDownload.includes(path.join(unzipFolder, file.entryName));
});

if (downloadedTranslationFiles.length > 0 && filesToUnzip.length === 0) {
vscode.window.showWarningMessage(
"Downloaded translations don't match the current project configuration. The translations for the following sources will be omitted"
);
return;
}

const omittedFiles = downloadedTranslationFiles
.map((file) => file.entryName)
.filter((entryName) => !filesToUnzip.some((entry) => entry.entryName === entryName));

if (omittedFiles.length > 0) {
vscode.window.showWarningMessage(
'Due to missing respective sources, the following translations will be omitted: ' +
omittedFiles.join(', ')
);
}

filesToUnzip.forEach((file) => {
const filePath = path.join(unzipFolder, file.entryName);
const directory = path.dirname(filePath);
Expand Down

0 comments on commit ad00af7

Please sign in to comment.