mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 09:35:38 -05:00
Move dacpac and schema compare localized strings (#9107)
* move localized strings * move schema compare localized strings
This commit is contained in:
@@ -4,11 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as loc from '../../localizedConstants';
|
||||
import { DacFxDataModel } from './models';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export abstract class BasePage {
|
||||
|
||||
protected readonly wizardPage: azdata.window.WizardPage;
|
||||
@@ -75,7 +73,7 @@ export abstract class BasePage {
|
||||
let srv = c.options.server;
|
||||
|
||||
if (!usr) {
|
||||
usr = localize('basePage.defaultUser', "default");
|
||||
usr = loc.defaultText;
|
||||
}
|
||||
|
||||
let finalName = `${srv} (${usr})`;
|
||||
|
||||
@@ -4,17 +4,15 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as loc from '../../localizedConstants';
|
||||
import { DataTierApplicationWizard, Operation } from '../dataTierApplicationWizard';
|
||||
import { DacFxDataModel } from './models';
|
||||
import { BasePage } from './basePage';
|
||||
import { sanitizeStringForFilename, isValidBasename, isValidBasenameErrorMessage } from './utils';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export abstract class DacFxConfigPage extends BasePage {
|
||||
|
||||
protected readonly wizardPage: azdata.window.WizardPage;
|
||||
@@ -44,7 +42,7 @@ export abstract class DacFxConfigPage extends BasePage {
|
||||
}
|
||||
|
||||
protected async createServerDropdown(isTargetServer: boolean): Promise<azdata.FormComponent> {
|
||||
const serverDropDownTitle = isTargetServer ? localize('dacFx.targetServerDropdownTitle', "Target Server") : localize('dacFx.sourceServerDropdownTitle', "Source Server");
|
||||
const serverDropDownTitle = isTargetServer ? loc.targetServer : loc.sourceServer;
|
||||
this.serverDropdown = this.view.modelBuilder.dropDown().withProperties({
|
||||
required: true,
|
||||
ariaLabel: serverDropDownTitle
|
||||
@@ -87,7 +85,7 @@ export abstract class DacFxConfigPage extends BasePage {
|
||||
.withValidation(component => !this.databaseNameExists(component.value))
|
||||
.withProperties({
|
||||
required: true,
|
||||
validationErrorMessage: localize('dacfx.databaseNameExistsErrorMessage', "A database with the same name already exists on the instance of SQL Server")
|
||||
validationErrorMessage: loc.databaseNameExistsErrorMessage
|
||||
}).component();
|
||||
|
||||
this.databaseTextBox.ariaLabel = title;
|
||||
@@ -102,7 +100,7 @@ export abstract class DacFxConfigPage extends BasePage {
|
||||
}
|
||||
|
||||
protected async createDatabaseDropdown(): Promise<azdata.FormComponent> {
|
||||
const databaseDropdownTitle = localize('dacFx.sourceDatabaseDropdownTitle', "Source Database");
|
||||
const databaseDropdownTitle = loc.sourceDatabase;
|
||||
this.databaseDropdown = this.view.modelBuilder.dropDown().withProperties({
|
||||
ariaLabel: databaseDropdownTitle
|
||||
}).component();
|
||||
@@ -174,11 +172,11 @@ export abstract class DacFxConfigPage extends BasePage {
|
||||
}
|
||||
});
|
||||
|
||||
this.fileTextBox.ariaLabel = localize('dacfx.fileLocationAriaLabel', "File Location");
|
||||
this.fileTextBox.ariaLabel = loc.fileLocation;
|
||||
this.fileButton = this.view.modelBuilder.button().withProperties({
|
||||
label: '•••',
|
||||
title: localize('dacfx.selectFile', "Select file"),
|
||||
ariaLabel: localize('dacfx.selectFile', "Select file")
|
||||
title: loc.selectFile,
|
||||
ariaLabel: loc.selectFile
|
||||
}).component();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as loc from '../../localizedConstants';
|
||||
const WINDOWS_INVALID_FILE_CHARS = /[\\/:\*\?"<>\|]/g;
|
||||
const UNIX_INVALID_FILE_CHARS = /[\\/]/g;
|
||||
const isWindows = os.platform() === 'win32';
|
||||
const WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])$/i;
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* Determines if a given character is a valid filename character
|
||||
@@ -99,38 +98,37 @@ export function isValidBasename(name: string | null | undefined): boolean {
|
||||
export function isValidBasenameErrorMessage(name: string | null | undefined): string {
|
||||
const invalidFileChars = isWindows ? WINDOWS_INVALID_FILE_CHARS : UNIX_INVALID_FILE_CHARS;
|
||||
if (!name) {
|
||||
return localize('dacfx.undefinedFileNameErrorMessage', "Undefined name");
|
||||
return loc.undefinedFilenameErrorMessage;
|
||||
}
|
||||
|
||||
if (isWindows && name[name.length - 1] === '.') {
|
||||
return localize('dacfx.fileNameEndingInPeriodErrorMessage', "File name cannot end with a period"); // Windows: file cannot end with a "."
|
||||
return loc.filenameEndingIsPeriodErrorMessage; // Windows: file cannot end with a "."
|
||||
}
|
||||
|
||||
let basename = path.parse(name).name;
|
||||
if (!basename || basename.length === 0 || /^\s+$/.test(basename)) {
|
||||
return localize('dacfx.whitespaceFilenameErrorMessage', "File name cannot be whitespace"); // require a name that is not just whitespace
|
||||
return loc.whitespaceFilenameErrorMessage; // require a name that is not just whitespace
|
||||
}
|
||||
|
||||
invalidFileChars.lastIndex = 0;
|
||||
if (invalidFileChars.test(basename)) {
|
||||
return localize('dacfx.invalidFileCharsErrorMessage', "Invalid file characters"); // check for certain invalid file characters
|
||||
return loc.invalidFileCharsErrorMessage; // check for certain invalid file characters
|
||||
}
|
||||
|
||||
if (isWindows && WINDOWS_FORBIDDEN_NAMES.test(basename)) {
|
||||
console.error('here');
|
||||
return localize('dacfx.reservedWindowsFileNameErrorMessage', "This file name is reserved for use by Windows. Choose another name and try again"); // check for certain invalid file names
|
||||
return loc.reservedWindowsFilenameErrorMessage; // check for certain invalid file names
|
||||
}
|
||||
|
||||
if (basename === '.' || basename === '..') {
|
||||
return localize('dacfx.reservedValueErrorMessage', "Reserved file name. Choose another name and try again"); // check for reserved values
|
||||
return loc.reservedWindowsFilenameErrorMessage; // check for reserved values
|
||||
}
|
||||
|
||||
if (isWindows && basename.length !== basename.trim().length) {
|
||||
return localize('dacfx.trailingWhitespaceErrorMessage', "File name cannot end with a whitespace"); // Windows: file cannot end with a whitespace
|
||||
return loc.trailingWhitespaceErrorMessage; // Windows: file cannot end with a whitespace
|
||||
}
|
||||
|
||||
if (basename.length > 255) {
|
||||
return localize('dacfx.tooLongFileNameErrorMessage', "File name is over 255 characters"); // most file systems do not allow files > 255 length
|
||||
return loc.tooLongFilenameErrorMessage; // most file systems do not allow files > 255 length
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user