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

Add banner that suggest to switch to preferred locale by user #554

Merged
merged 26 commits into from Mar 30, 2023

Conversation

marinaaisa
Copy link
Member

@marinaaisa marinaaisa commented Mar 22, 2023

Bug/issue #104924748, if applicable:

Summary

Add banner that suggest to switch to preferred locale by user

Dependencies

NA

Testing

Steps:

  1. Add the following to theme-settings.json file at public folder
{
  "features": {
    "docs": {
      "i18n": {
        "enable": true
      }
    }
  }
}
  1. Run npm run serve
  2. Go to the bottom of the page and change the language in the locale selector Chinese for example
  3. Delete localStorage
  4. If you have your browser in English, you should assert that a banner is displayed

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

@@ -1,4 +1,6 @@
{
"view-in": "View in 日本語",
Copy link
Member Author

Choose a reason for hiding this comment

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

To do: add correct translation strings

Copy link
Contributor

@dobromir-hristov dobromir-hristov left a comment

Choose a reason for hiding this comment

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

Code looks good. I cannot test, because I dont have a dataset, but make sure the extra header does not intervene with the sticky components, like the navigator, both on mobile and desktop variants.

I remember I added some guards against such things, but in any case...

src/components/LocaleSelector.vue Outdated Show resolved Hide resolved
@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa marinaaisa marked this pull request as ready for review March 23, 2023 13:07
src/components/i18nBanner.vue Outdated Show resolved Hide resolved
src/components/i18nBanner.vue Outdated Show resolved Hide resolved
src/components/LocaleSelector.vue Outdated Show resolved Hide resolved
@marinaaisa
Copy link
Member Author

Thanks Dobri! I've addressed your feedback. Give it another try :)

Copy link
Contributor

@dobromir-hristov dobromir-hristov left a comment

Choose a reason for hiding this comment

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

LGTM, will wait on design to approve too

src/App.vue Outdated Show resolved Hide resolved
@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa marinaaisa merged commit 9c5fddb into apple:main Mar 30, 2023
1 check passed
@marinaaisa marinaaisa deleted the r104924748/i18n-banner branch March 30, 2023 15:26
hqhhuang pushed a commit to hqhhuang/swift-docc-render that referenced this pull request Mar 30, 2023
)

* [rdar://104924748] feat: start working on i18n banner

* [rdar://104924748] feat: continue working on i18nbanner

* [rdar://104924748] feat: store i18 banner in AppStore

* [rdar://104924748] test: add and fix tests + fix headers

* [rdar://104924748] refactor: styles

* [rdar://104924748] fix: typo

* [rdar://104924748] fix: alignment for i18n banner

* [rdar://104924748] test: fix test

* [rdar://104924748] fix: close icon size

* [rdar://104924748] fix: banner code size

* [rdar://104924748] fix: address feedback

* [rdar://104924748] refactor: getLocaleParam function

* [rdar://104924748] chore: update colors

* [rdar://104924748] chore: move i18nBanner to App component

* [rdar://104924748] refactor: replace i18nBanner with SuggestLang

* [rdar://104924748] chore: move SuggestLang out of the header slot

* [rdar://104924748] chore: use suggest-lang-height var

* [rdar://104924748] chore: updates i18n strings

* [rdar://104924748] test: fix tests
marinaaisa added a commit to marinaaisa/swift-docc-render that referenced this pull request Apr 4, 2023
)

* [rdar://104924748] feat: start working on i18n banner

* [rdar://104924748] feat: continue working on i18nbanner

* [rdar://104924748] feat: store i18 banner in AppStore

* [rdar://104924748] test: add and fix tests + fix headers

* [rdar://104924748] refactor: styles

* [rdar://104924748] fix: typo

* [rdar://104924748] fix: alignment for i18n banner

* [rdar://104924748] test: fix test

* [rdar://104924748] fix: close icon size

* [rdar://104924748] fix: banner code size

* [rdar://104924748] fix: address feedback

* [rdar://104924748] refactor: getLocaleParam function

* [rdar://104924748] chore: update colors

* [rdar://104924748] chore: move i18nBanner to App component

* [rdar://104924748] refactor: replace i18nBanner with SuggestLang

* [rdar://104924748] chore: move SuggestLang out of the header slot

* [rdar://104924748] chore: use suggest-lang-height var

* [rdar://104924748] chore: updates i18n strings

* [rdar://104924748] test: fix tests
marinaaisa added a commit that referenced this pull request Apr 5, 2023
…576)

* [rdar://104924748] feat: start working on i18n banner

* [rdar://104924748] feat: continue working on i18nbanner

* [rdar://104924748] feat: store i18 banner in AppStore

* [rdar://104924748] test: add and fix tests + fix headers

* [rdar://104924748] refactor: styles

* [rdar://104924748] fix: typo

* [rdar://104924748] fix: alignment for i18n banner

* [rdar://104924748] test: fix test

* [rdar://104924748] fix: close icon size

* [rdar://104924748] fix: banner code size

* [rdar://104924748] fix: address feedback

* [rdar://104924748] refactor: getLocaleParam function

* [rdar://104924748] chore: update colors

* [rdar://104924748] chore: move i18nBanner to App component

* [rdar://104924748] refactor: replace i18nBanner with SuggestLang

* [rdar://104924748] chore: move SuggestLang out of the header slot

* [rdar://104924748] chore: use suggest-lang-height var

* [rdar://104924748] chore: updates i18n strings

* [rdar://104924748] test: fix tests
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.

None yet

2 participants