Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move most strings in the package to use vscode.l10n function #1158

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
146 changes: 146 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"Failed to lookup certificate {0}": "Failed to lookup certificate {0}",
"Unable to find a name for {0}": "Unable to find a name for {0}",
"Unable to find project dir for {0}": "Unable to find project dir for {0}",
"Failed to run command": "Failed to run command",
"No active edtor": "No active edtor",
"File is not part of an Alloy project": "File is not part of an Alloy project",
"File is not a controller, style, view or widget": "File is not a controller, style, view or widget",
"Unable to find related file": "Unable to find related file",
"No active editor": "No active editor",
"Project is not a Titanium application": "Project is not a Titanium application",
"Errors found in tiapp.xml": "Errors found in tiapp.xml",
"{0} on line {1}": "{0} on line {1}",
"Open tiapp.xml": "Open tiapp.xml",
"Cannot continue startup until all issues are resolved": "Cannot continue startup until all issues are resolved",
"Fetching environment information": "Fetching environment information",
"Error fetching Titanium environment": "Error fetching Titanium environment",
"Failed to get environment information": "Failed to get environment information",
"View Error": "View Error",
"Titanium Updates": "Titanium Updates",
"Checking for latest updates": "Checking for latest updates",
"Please select updates": "Please select updates",
"Installing {0} ({1}/{2})": "Installing {0} ({1}/{2})",
"Installed {label} ({counter}/{selectedUpdates})": "Installed {label} ({counter}/{selectedUpdates})",
"Failed to update to {0} as it must be ran with sudo": "Failed to update to {0} as it must be ran with sudo",
"Failed to set {0} as the selected SDK. Would you like to manually select it?": "Failed to set {0} as the selected SDK. Would you like to manually select it?",
"Select": "Select",
"Failed to update to {0}": "Failed to update to {0}",
"Installed {0} update": "Installed {0} update",
"Installed {0} updates": "Installed {0} updates",
"{0} and failed to install {1} update": "{0} and failed to install {1} update",
"{0}and failed to install {1} updates": "{0}and failed to install {1} updates",
"user cancelled": "user cancelled",
"Process exited with {0}": "Process exited with {0}",
"Unable to resolve workspace folder for {0}": "Unable to resolve workspace folder for {0}",
"Unknown project type {0}": "Unknown project type {0}",
"Unknown platform {0}": "Unknown platform {0}",
"Invalid configuration, please specify a platform": "Invalid configuration, please specify a platform",
"Error running task": "Error running task",
"Task cancelled as no selection occurred": "Task cancelled as no selection occurred",
"Unable to find certificate {0}": "Unable to find certificate {0}",
"Unable to find valid provisioning profile for {0}": "Unable to find valid provisioning profile for {0}",
"No \"target\" value provided": "No \"target\" value provided",
"Browse": "Browse",
"Output Into Xcode": "Output Into Xcode",
"Choose output location": "Choose output location",
"Provided output directory {0} cannot be found": "Provided output directory {0} cannot be found",
"Project directory {0} does not exist": "Project directory {0} does not exist",
"Unable to determine project type from {0}": "Unable to determine project type from {0}",
"Unable to find loaded project for {0}, please ensure it is active in the workspace": "Unable to find loaded project for {0}, please ensure it is active in the workspace",
"Failed to find debug port associated with {0}. Please try setting a \"port\" property in the configuration.": "Failed to find debug port associated with {0}. Please try setting a \"port\" property in the configuration.",
"Choose platforms": "Choose platforms",
"At least one platform must be selected": "At least one platform must be selected",
"Select Android codebase": "Select Android codebase",
"Select iOS codebase": "Select iOS codebase",
"Select where to create your project": "Select where to create your project",
"Enter your path": "Enter your path",
"Please select a folder to perform action within": "Please select a folder to perform action within",
"Expires: {0}": "Expires: {0}",
"Select certificate": "Select certificate",
"Unable to resolve certificate {0}": "Unable to resolve certificate {0}",
"Select provisioning profile": "Select provisioning profile",
"Unable to resolve provisioning profile {0}": "Unable to resolve provisioning profile {0}",
"Select device": "Select device",
"Select simulator version": "Select simulator version",
"iOS Version {0} does not exist": "iOS Version {0} does not exist",
"Select simulator": "Select simulator",
"No devices detected, refresh device information?": "No devices detected, refresh device information?",
"Refresh Devices": "Refresh Devices",
"Select Android device": "Select Android device",
"Select emulator": "Select emulator",
"Browse for keystore": "Browse for keystore",
"Create keystore": "Create keystore",
"Last used {0}": "Last used {0}",
"Saved {0}": "Saved {0}",
"Browse, create, or use last keystore": "Browse, create, or use last keystore",
"No keystore was selected": "No keystore was selected",
"Provided keystorePath value \"{0}\" does not exist": "Provided keystorePath value \"{0}\" does not exist",
"Using stored information for {0}. If this is unexpected or your build errors, clear this information using the button below": "Using stored information for {0}. If this is unexpected or your build errors, clear this information using the button below",
"Delete Information": "Delete Information",
"No keystore location was provided, so could not delete": "No keystore location was provided, so could not delete",
"Deleted stored information for {0}": "Deleted stored information for {0}",
"Enter your keystore alias": "Enter your keystore alias",
"Enter your keystore password": "Enter your keystore password",
"Enter your keystore private key password (optional)": "Enter your keystore private key password (optional)",
"Would you like to store this information?": "Would you like to store this information?",
"Errors found in tiapp.xml: no sdk-version found": "Errors found in tiapp.xml: no sdk-version found",
"Errors found in tiapp.xml: multiple sdk-version tags found.": "Errors found in tiapp.xml: multiple sdk-version tags found.",
"Autocomplete suggestions generated for": "Autocomplete suggestions generated for",
"Titanium SDK Installation": "Titanium SDK Installation",
"Error generating autocomplete suggestions. {0}": "Error generating autocomplete suggestions. {0}",
"Image not found": "Image not found",
"Generate style ({0})": "Generate style ({0})",
"Generate function ({0})": "Generate function ({0})",
"Generate i18n string": "Generate i18n string",
"Package Module failed": "Package Module failed",
"Rerun": "Rerun",
"Package App failed": "Package App failed",
"Please select a project to build": "Please select a project to build",
"Please select a project to package": "Please select a project to package",
"Select log level": "Select log level",
"Enabled LiveView": "Enabled LiveView",
"Disabled LiveView": "Disabled LiveView",
"Please select a project to debug": "Please select a project to debug",
"There are {0} updates available": "There are {0} updates available",
"There is {0} update available": "There is {0} update available",
"Install": "Install",
"View": "View",
"Failed to check for updates": "Failed to check for updates",
"Please select the exported settings file": "Please select the exported settings file",
"Select a project to generate a task definition for": "Select a project to generate a task definition for",
"Select signing information?": "Select signing information?",
"Select keystore information?": "Select keystore information?",
"Generated task {0}": "Generated task {0}",
"Show": "Show",
"Failed to generate task {0}": "Failed to generate task {0}",
"Enter your module name": "Enter your module name",
"Enter your module ID": "Enter your module ID",
"Browse for location": "Browse for location",
"Select an open project to create the keystore in or browse for folder": "Select an open project to create the keystore in or browse for folder",
"No folder was selected": "No folder was selected",
"Keystore already exists at {0}. Please delete it or choose a new location": "Keystore already exists at {0}. Please delete it or choose a new location",
"Enter your application name": "Enter your application name",
"Enter your application ID": "Enter your application ID",
"Invalid app id!": "Invalid app id!",
"That app already exists. Would you like to overwrite?": "That app already exists. Would you like to overwrite?",
"App already exists and chose to not overwrite": "App already exists and chose to not overwrite",
"Creating application": "Creating application",
"Creating Alloy project": "Creating Alloy project",
"Project created. Would you like to open it?": "Project created. Would you like to open it?",
"Open in new window": "Open in new window",
"Open in workspace": "Open in workspace",
"Failed to create application": "Failed to create application",
"Cleaning project": "Cleaning project",
"Build Module failed.": "Build Module failed.",
"Build App failed": "Build App failed",
"Enter the name for your {0}": "Enter the name for your {0}",
"Yes": "Yes",
"No": "No",
"{0} already exists. Overwrite it?": "{0} already exists. Overwrite it?",
"{0} {name} created successfully": "{0} {name} created successfully",
"Open": "Open",
"Failed to create Alloy {0} {1}": "Failed to create Alloy {0} {1}",
"Which adapter type?": "Which adapter type?",
"{0} {1} created successfully": "{0} {1} created successfully"
}
16 changes: 8 additions & 8 deletions src/commands/alloyGenerate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs-extra';
import * as path from 'path';

import { window, workspace } from 'vscode';
import { l10n, window, workspace } from 'vscode';
import { inputBox, quickPick } from '../quickpicks';
import { capitalizeFirstLetter } from '../utils';
import { UserCancellation } from './common';
Expand Down Expand Up @@ -57,7 +57,7 @@ export interface AlloyModelGenerateOptions {

async function promptForDetails (type: AlloyComponentType, folder: AlloyComponentFolder, extension: AlloyComponentExtension):
Promise<{ cwd: string; filePaths: string[]; name: string; type: AlloyComponentType }> {
const name = await inputBox({ prompt: `Enter the name for your ${type}` });
const name = await inputBox({ prompt: l10n.t('Enter the name for your {0}', type) });

const { folder: workspaceFolder } = await promptForWorkspaceFolder();
const cwd = workspaceFolder.uri.fsPath;
Expand All @@ -73,7 +73,7 @@ Promise<{ cwd: string; filePaths: string[]; name: string; type: AlloyComponentTy
filePaths.push(mainFile);
}
if (await fs.pathExists(mainFile)) {
const shouldDelete = await quickPick([ { id: 'yes', label: 'Yes' }, { id: 'no', label: 'No' } ], { placeHolder: `${name} already exists. Overwrite it?` });
const shouldDelete = await quickPick([ { id: 'yes', label: l10n.t('Yes') }, { id: 'no', label: l10n.t('No') } ], { placeHolder: l10n.t('{0} already exists. Overwrite it?') });
if (shouldDelete.id === 'no') {
throw new UserCancellation();
}
Expand All @@ -95,7 +95,7 @@ export async function generateComponent (type: Exclude<AlloyComponentType, Alloy
name,
force: true
});
const shouldOpen = await window.showInformationMessage(`${capitalizeFirstLetter(type)} ${name} created successfully`, { title: 'Open' });
const shouldOpen = await window.showInformationMessage(l10n.t('{0} {name} created successfully', capitalizeFirstLetter(type), name), { title: l10n.t('Open') });
if (shouldOpen) {
for (const file of filePaths) {
const document = await workspace.openTextDocument(file);
Expand All @@ -107,15 +107,15 @@ export async function generateComponent (type: Exclude<AlloyComponentType, Alloy
if (error instanceof UserCancellation) {
return;
}
window.showErrorMessage(`Failed to create Alloy ${type} ${name}`);
window.showErrorMessage(l10n.t('Failed to create Alloy {0} {1}', type, name as string));
}
}

export async function generateModel (): Promise<void> {
let name;
try {
const creationArgs = await promptForDetails(AlloyComponentType.Model, AlloyComponentFolder.Model, AlloyComponentExtension.Model);
const adapterType = await quickPick([ { id: 'properties', label: 'properties' }, { id: 'sql', label: 'sql' } ], { canPickMany: false, placeHolder: 'Which adapter type?' });
const adapterType = await quickPick([ { id: 'properties', label: 'properties' }, { id: 'sql', label: 'sql' } ], { canPickMany: false, placeHolder: l10n.t('Which adapter type?') });
const cwd = creationArgs.cwd;
const filePaths = creationArgs.filePaths;
name = creationArgs.name;
Expand All @@ -126,7 +126,7 @@ export async function generateModel (): Promise<void> {
name,
force: true
});
const shouldOpen = await window.showInformationMessage(`${capitalizeFirstLetter(AlloyComponentType.Model)} ${name} created successfully`, { title: 'Open' });
const shouldOpen = await window.showInformationMessage(l10n.t('{0} {1} created successfully', capitalizeFirstLetter(AlloyComponentType.Model), name), { title: l10n.t('Open') });
if (shouldOpen) {
for (const file of filePaths) {
const document = await workspace.openTextDocument(file);
Expand All @@ -137,7 +137,7 @@ export async function generateModel (): Promise<void> {
if (error instanceof UserCancellation) {
return;
}
window.showErrorMessage(`Failed to create Alloy ${AlloyComponentType.Model} ${name}`);
window.showErrorMessage(l10n.t('Failed to create Alloy {0} {1}', AlloyComponentType.Model, name as string));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/buildApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export async function buildApplication (node?: DeviceNode | OSVerNode | Platform
} catch (error) {
if (error instanceof InteractionError) {
await handleInteractionError(error);
const choice = await vscode.window.showErrorMessage('Build App failed', { title: 'Rerun' });
if (choice?.title === 'Rerun') {
const choice = await vscode.window.showErrorMessage(vscode.l10n.t('Build App failed'), { id: 'rerun', title: vscode.l10n.t('Rerun') });
if (choice?.id === 'rerun') {
buildApplication(node);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/buildModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export async function buildModule (node?: DeviceNode | OSVerNode | PlatformNode
} catch (error) {
if (error instanceof InteractionError) {
await handleInteractionError(error);
const choice = await vscode.window.showErrorMessage('Build Module failed.', { title: 'Rerun' });
if (choice?.title === 'Rerun') {
const choice = await vscode.window.showErrorMessage(vscode.l10n.t('Build Module failed.'), { id: 'rerun', title: vscode.l10n.t('Rerun') });
if (choice?.id === 'rerun') {
buildModule(node);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/clean.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import { ProgressLocation, window } from 'vscode';
import { ProgressLocation, l10n, window } from 'vscode';
import * as fs from 'fs-extra';
import { ExtensionContainer } from '../container';
import { selectPlatform, promptForWorkspaceFolder } from '../quickpicks/common';
Expand All @@ -20,7 +20,7 @@ export async function cleanApplication (): Promise<void> {
} else {
projectDir = folder.uri.fsPath;
}
await window.withProgress({ cancellable: false, location: ProgressLocation.Notification, title: 'Cleaning project' }, async () => {
await window.withProgress({ cancellable: false, location: ProgressLocation.Notification, title: l10n.t('Cleaning project') }, async () => {
const quotedArgs = [
'clean',
'--project-dir', projectDir,
Expand Down
8 changes: 4 additions & 4 deletions src/commands/createKeystore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function createKeystore (): Promise<KeystoreInfo> {
const choices = [
{
id: 'browse',
label: 'Browse for location'
label: vscode.l10n.t('Browse for location')
}
];

Expand All @@ -45,13 +45,13 @@ export async function createKeystore (): Promise<KeystoreInfo> {
});
}

const choice = await quickPick(choices, { placeHolder: 'Select an open project to create the keystore in or browse for folder' }, { forceShow: true });
const choice = await quickPick(choices, { placeHolder: vscode.l10n.t('Select an open project to create the keystore in or browse for folder') }, { forceShow: true });

if (choice.id === 'browse') {
const selection = await vscode.window.showOpenDialog({ canSelectFolders: true, canSelectFiles: false, canSelectMany: false });

if (!selection) {
await vscode.window.showErrorMessage('No folder was selected');
await vscode.window.showErrorMessage(vscode.l10n.t('No folder was selected'));
return;
}

Expand All @@ -63,7 +63,7 @@ export async function createKeystore (): Promise<KeystoreInfo> {
const keystorePath = path.join(folder, 'keystore');

if (await fs.pathExists(keystorePath)) {
vscode.window.showErrorMessage(`Keystore already exists at ${keystorePath}. Please delete it or choose a new location`);
vscode.window.showErrorMessage(vscode.l10n.t('Keystore already exists at {0}. Please delete it or choose a new location', keystorePath));
return reject();
}

Expand Down
6 changes: 3 additions & 3 deletions src/commands/createModule.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs-extra';
import * as path from 'path';

import { commands, ProgressLocation, Uri, window, workspace } from 'vscode';
import { commands, l10n, ProgressLocation, Uri, window, workspace } from 'vscode';
import { VSCodeCommands, WorkspaceState } from '../constants';
import { ExtensionContainer } from '../container';
import { inputBox, selectCodeBases, selectCreationLocation, selectPlatforms, yesNoQuestion } from '../quickpicks';
Expand All @@ -20,9 +20,9 @@ export async function createModule (): Promise<void> {
const logLevel = ExtensionContainer.config.general.logLevel;
const lastCreationPath = ExtensionContainer.context.workspaceState.get<string>(WorkspaceState.LastCreationPath);

const name = await inputBox({ prompt: 'Enter your module name' });
const name = await inputBox({ prompt: l10n.t('Enter your module name') });
const id = await inputBox({
prompt: 'Enter your module ID',
prompt: l10n.t('Enter your module ID'),
validateInput: currentAppId => {
const isValid = validateAppId(currentAppId);
if (!isValid) {
Expand Down
Loading
Loading