Skip to content

Commit

Permalink
[PowerPages] Update localization strings for site creation and improv…
Browse files Browse the repository at this point in the history
…e error handling
  • Loading branch information
amitjoshi committed Dec 16, 2024
1 parent e900b16 commit 926df6a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 29 deletions.
55 changes: 29 additions & 26 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,40 +83,18 @@
"Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.": "Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.",
"Checking for active auth profile...": "Checking for active auth profile...",
"@PowerPages is not yet available in your region.": "@PowerPages is not yet available in your region.",
"Failed to get site content from NL2Site service": "Failed to get site content from NL2Site service",
"Generating webpages...": "Generating webpages...",
"Generating a new Power Pages site...": "Generating a new Power Pages site...",
"Failed to create a new Power Pages site. Please try again.": "Failed to create a new Power Pages site. Please try again.",
"Creating Site Records": "Creating Site Records",
"Initializing site manager...": "Initializing site manager...",
"Saving site...": "Saving site...",
"Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": {
"message": "Select Folder for new PCF Control",
"comment": [
"Do not translate 'PCF' as it is a product name."
]
},
"Preparing pac CLI (v{0}).../{0} represents the version number": {
"message": "Preparing pac CLI (v{0})...",
"comment": [
"{0} represents the version number"
]
},
"The pac CLI is ready for use in your VS Code terminal!": "The pac CLI is ready for use in your VS Code terminal!",
"Cannot install pac CLI: {0}/{0} represents the error message returned from the exception": {
"message": "Cannot install pac CLI: {0}",
"comment": [
"{0} represents the error message returned from the exception"
]
},
"Installing Power Pages generator(v{0}).../{0} represents the version number": {
"message": "Installing Power Pages generator(v{0})...",
"comment": [
"{0} represents the version number"
]
},
"dotnet sdk 6.0 or greater must be installed/Do not translate 'dotnet' or 'sdk'": {
"message": "dotnet sdk 6.0 or greater must be installed",
"comment": [
"Do not translate 'dotnet' or 'sdk'"
]
},
"File might be referenced by name {0} here./{0} represents the name of the file": {
"message": "File might be referenced by name {0} here.",
"comment": [
Expand Down Expand Up @@ -188,6 +166,12 @@
"Do not translate 'npm'"
]
},
"Installing Power Pages generator(v{0}).../{0} represents the version number": {
"message": "Installing Power Pages generator(v{0})...",
"comment": [
"{0} represents the version number"
]
},
"Cannot install Power Pages generator: {0}/{0} represents the error message returned from the exception": {
"message": "Cannot install Power Pages generator: {0}",
"comment": [
Expand Down Expand Up @@ -217,6 +201,25 @@
"The {3} represents Dataverse Environment's Organization ID (GUID)"
]
},
"Preparing pac CLI (v{0}).../{0} represents the version number": {
"message": "Preparing pac CLI (v{0})...",
"comment": [
"{0} represents the version number"
]
},
"The pac CLI is ready for use in your VS Code terminal!": "The pac CLI is ready for use in your VS Code terminal!",
"Cannot install pac CLI: {0}/{0} represents the error message returned from the exception": {
"message": "Cannot install pac CLI: {0}",
"comment": [
"{0} represents the error message returned from the exception"
]
},
"dotnet sdk 6.0 or greater must be installed/Do not translate 'dotnet' or 'sdk'": {
"message": "dotnet sdk 6.0 or greater must be installed",
"comment": [
"Do not translate 'dotnet' or 'sdk'"
]
},
"Confirm": "Confirm",
"Are you sure you want to clear all the Auth Profiles?": "Are you sure you want to clear all the Auth Profiles?",
"Cancel": "Cancel",
Expand Down
15 changes: 12 additions & 3 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
<trans-unit id="++CODE++b749e205302cc21952a1e9646569ca0af9017cc5f39dd741830551bdd4ae823e">
<source xml:lang="en">Copy to clipboard</source>
</trans-unit>
<trans-unit id="++CODE++6dc7db56b51f2fb60ba165717916e54647dd57ed444c8e4f9224aa37fc1a9f40">
<source xml:lang="en">Creating Site Records</source>
</trans-unit>
<trans-unit id="++CODE++446092146c92f1aa2441a29971d3844b0add13a951c45c491423f506bbe4edab">
<source xml:lang="en">Creating {0}...</source>
<note>{0} will be replaced by the entity type.</note>
Expand Down Expand Up @@ -143,6 +146,9 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++f9e17ed11037dab93f8820c30db63b2ff2a045b5761f71818b7291afae60f199">
<source xml:lang="en">Explain the following code {% include 'Page Copy'%}</source>
</trans-unit>
<trans-unit id="++CODE++b985f1515c42b4b5b0c11a3d7b3286fc9d66997d476668ab1f93a4a11499fef5">
<source xml:lang="en">Failed to create a new Power Pages site. Please try again.</source>
</trans-unit>
<trans-unit id="++CODE++2310c6b7e5953cab877859ba1fcfa98e58e1508677df9412010e9b578ea237f4">
<source xml:lang="en">Failed to create: {0}.</source>
<note>{0} will be replaced by the error message.</note>
Expand All @@ -159,9 +165,6 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++862d6197d64601aa13ce30db5ec5b8f819ad00fe21e3b031a3e47fe22ef68fb3">
<source xml:lang="en">Failed to get file ready for edit: {0}</source>
</trans-unit>
<trans-unit id="++CODE++41405814c44fb391a3f8e31d1a3bc20299cd2e87979ebfbd1eb9488be12c617a">
<source xml:lang="en">Failed to get site content from NL2Site service</source>
</trans-unit>
<trans-unit id="++CODE++a9e36b880dd45b64ae5601865540605296febf9bd855fc46d9c35c2c2ed9a7f2">
<source xml:lang="en">Feature is not enabled for this geo.</source>
</trans-unit>
Expand Down Expand Up @@ -214,6 +217,9 @@ Return to this chat and @powerpages can help you write and edit your website cod
<trans-unit id="++CODE++08295f3385931e35c850b945e2ae04882452c4bf0dd575f70e95aaa6ed00daa9">
<source xml:lang="en">In your own words, describe what you need. You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.</source>
</trans-unit>
<trans-unit id="++CODE++76b6e817a87a4f7034544e174c3d44a0a6ecf2418a585b2c9d613cade58806d0">
<source xml:lang="en">Initializing site manager...</source>
</trans-unit>
<trans-unit id="++CODE++e992151b1efc99f93484c7d7f3076b66ab072a8af2383e96104cc597c971339c">
<source xml:lang="en">Insert code into editor</source>
</trans-unit>
Expand Down Expand Up @@ -357,6 +363,9 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++b62120c5416487f4c793d75aee7fea083971e5ac665a3f35767023f408f482e5">
<source xml:lang="en">Response data is empty</source>
</trans-unit>
<trans-unit id="++CODE++c9e3c5bda1d9c4ccdf4ae79e0026c22152a6d39a81630aeb19b2f193562003f5">
<source xml:lang="en">Saving site...</source>
</trans-unit>
<trans-unit id="++CODE++0134bc37f2fdeb11daa9e760ecee0ef9706989b33f77a38daadb8b7aae685749">
<source xml:lang="en">Saving your file ...</source>
</trans-unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export function registerButtonCommands() {
vscode.commands.registerCommand(CREATE_SITE_BTN_CMD, async ({ siteName, sitePages, sitePagesList, envList, contentProvider, telemetry, isCreateSiteInputsReceived }: ICreateSiteCommandArgs) => {
if (!isCreateSiteInputsReceived) {
// Update Page Content will be used for the site creation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const updatedPages = sitePages.map((page: any) => {
return {
...page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function previewSitePagesContent(

try {
const sitePagesContent: { name: string; content: string }[] = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
sitePages.forEach((page: any) => {
sitePagesContent.push({ name: page.metadata.pageTitle, content: page.code });
});
Expand Down Expand Up @@ -198,6 +199,7 @@ export async function collectSiteCreationInputs(siteName: string, envList: IEnvI
}


// eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function populateSiteRecords(siteName: string, sitePagesList: string[], sitePages: any, orgUrl: string, telemetry: ITelemetry) {
return vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
Expand Down Expand Up @@ -240,14 +242,17 @@ export async function populateSiteRecords(siteName: string, sitePagesList: strin
}


// eslint-disable-next-line @typescript-eslint/no-explicit-any
function createSitePagesMap(sitePagesList: string[], sitePages: any): Record<string, any> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return sitePagesList.reduce((acc: Record<string, any>, pageName: string, index: number) => {
acc[pageName] = sitePages[index];
return acc;
}, {});
}


// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function processSitePages(sitePagesMap: Record<string, any>, siteManager: PowerPagesSiteManager): Promise<void> {
const { actions } = siteManager.getSiteDataAndActions();
const promises = Object.entries(sitePagesMap).map(([pageName, pageContent]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export interface ISiteInputState {

export interface ICreateSiteCommandArgs {
siteName: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
sitePages: any[];
sitePagesList: string[];
envList: IEnvInfo[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const getFileUploadHeaders = (fileName: string, dataverseToken: string) =
};
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function createHttpRequestOptions(method: string, url: string, body: any, headers?: Record<string, string>): any {
return {
method,
Expand Down

0 comments on commit 926df6a

Please sign in to comment.