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

fix: missing preview i18n #255

Merged
merged 8 commits into from
Aug 19, 2024
Merged

fix: missing preview i18n #255

merged 8 commits into from
Aug 19, 2024

Conversation

ycs77
Copy link
Contributor

@ycs77 ycs77 commented Aug 18, 2024

Problem

I'm currently using the tutorialkit version v0.1.5, if added some i18n texts:

docs/demo/src/content/tutorial/meta.md

---
type: tutorial
mainCommand: ['npm run dev', 'Starting http server']
prepareCommands:
  - ['npm install', 'Installing dependencies']

# add the i18n texts
i18n:
  prepareEnvironmentTitleText: '啟動環境'
  previewTitleText: '預覽'
  toggleTerminalButtonText: '切換終端機'
---

The i18n will work on webcontainer starting:

螢幕擷取畫面 2024-08-18 153215

But not working on webcontainer started:

螢幕擷取畫面 2024-08-18 155256

PR Added

  • Add missing Toggle Terminal i18n text in started <Preview>
  • Add missing Preview i18n text

Copy link

stackblitz bot commented Aug 18, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preview title is also configurable via previews option:

---
type: tutorial
previews:
  - title: 預覽
    port: 5173
---

But it does make sense to be able to configure the default text via i18n as well.

@ycs77
Copy link
Contributor Author

ycs77 commented Aug 18, 2024

The preview title is also configurable via previews option:

Oh, I see.


When I want to do i18n, I intuitively look for replaceable values ​​in the i18n options.

Copy link
Member

@Nemikolh Nemikolh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work! 🌟

I think we can definitely land this. Thanks for the PR! 😃

packages/types/src/schemas/i18n.ts Outdated Show resolved Hide resolved
packages/types/src/schemas/i18n.ts Outdated Show resolved Hide resolved
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also mention this in documentation:

```ts
type I18nText = {
/**
* Template for formatting a part. Variables: ${index} and ${title}.
*
* @default 'Part ${index}: ${title}'
*/
partTemplate?: string,
/**
* Text of the edit page link.
*
* @default 'Edit this page'
*/
editPageText?: string
/**
* Text of the WebContainer link.
*
* @default 'Powered by WebContainers'
*/
webcontainerLinkText?: string,
/**
* Text shown when there are no previews or steps to show in the prepare environment section.
*
* @default 'Start WebContainer'
*/
startWebContainerText?: string,
/**
* Text shown on the call to action button to start webcontainer when boot was blocked
* due to memory restrictions.
*
* @default 'No preview to run nor steps to show'
*/
noPreviewNorStepsText?: string,
}
```

@ycs77 ycs77 requested a review from AriPerkkio August 19, 2024 09:07
@ycs77
Copy link
Contributor Author

ycs77 commented Aug 19, 2024

Wait a minute while I look at why the test failed.

@AriPerkkio
Copy link
Member

All tests are failing. We are pinning a dependency version of transitive dependency in test cases. Another dependency just updated and doesn't support that version. There's fix in #261.

Copy link
Member

@Nemikolh Nemikolh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I think the test failure is probably unrelated to this PR.

@Nemikolh
Copy link
Member

@ycs77 You have a lint error! Once fixed, we can merge your PR 🙌

@Nemikolh Nemikolh merged commit 095ed57 into stackblitz:main Aug 19, 2024
9 checks passed
@ycs77 ycs77 deleted the fix-preview-i18n branch August 19, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants