Repository navigation
fix(scout): zh-CN welcome and start labels; raw id in My Workspace (TASK-550, TASK-551) #2737
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b761e86
fix(i18n): show Scout's start labels in zh-CN by id (TASK-550)
lilyshen0722 74c94d5
fix(onboarding): store Scout's welcome body in the signup language (T…
lilyshen0722 59f18a5
fix(i18n): capitalise Pod in Scout's zh-CN start label (TASK-550)
lilyshen0722 1dd4379
fix(i18n): adjudicate Scout's zh-CN start labels against the glossary…
lilyshen0722 8264f1b
test(i18n): pin zh-CN start labels in the thread render (TASK-550)
lilyshen0722 dc9f74c
fix(i18n): apply the zh-CN glossary pass to Scout's start labels (TAS…
lilyshen0722 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // TASK-550: Scout's welcome body is stored once, at signup, in the language | ||
| // the person signed up in. The English starts stay as they are, because Scout | ||
| // matches on those labels. | ||
| const { | ||
| SCOUT_WELCOME, | ||
| SCOUT_STARTS, | ||
| normalizeScoutLocale, | ||
| scoutWelcomeFor, | ||
| } = require('../../../config/native-agents/scout'); | ||
|
|
||
| describe('Scout welcome locale', () => { | ||
| it('keeps the English welcome unchanged', () => { | ||
| expect(scoutWelcomeFor('en')).toBe('What would you like to do first?'); | ||
| expect(SCOUT_WELCOME).toBe('What would you like to do first?'); | ||
| }); | ||
|
|
||
| it('returns a zh-CN welcome with no English in it', () => { | ||
| const zh = scoutWelcomeFor('zh-CN'); | ||
| expect(zh).not.toBe(SCOUT_WELCOME); | ||
| expect(zh).not.toMatch(/[A-Za-z]{2,}/); | ||
| }); | ||
|
|
||
| it('falls back to English for anything that is not zh-CN', () => { | ||
| expect(normalizeScoutLocale(undefined)).toBe('en'); | ||
| expect(normalizeScoutLocale('fr')).toBe('en'); | ||
| expect(normalizeScoutLocale('zh')).toBe('en'); | ||
| expect(scoutWelcomeFor('fr')).toBe(SCOUT_WELCOME); | ||
| }); | ||
|
|
||
| it('keeps the start labels in English, since Scout reads them', () => { | ||
| expect(SCOUT_STARTS.map((s) => s.label)).toEqual([ | ||
| 'Connect an agent I already use', | ||
| 'Start a pod for a project', | ||
| ]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { act } from '@testing-library/react'; | ||
| import i18n, { i18nReady, LANGUAGE_STORAGE_KEY } from '..'; | ||
|
|
||
| // TASK-550: Scout's welcome starts are sent to Scout by their English labels | ||
| // (backend/config/native-agents/scout.ts), so only the displayed text is | ||
| // translated, by id. Every id the welcome can offer needs a zh-CN label. | ||
| const START_IDS = ['connect-agent', 'start-pod', 'run-hosted']; | ||
|
|
||
| describe('Scout welcome start labels', () => { | ||
| beforeAll(async () => { | ||
| await i18nReady; | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| localStorage.removeItem(LANGUAGE_STORAGE_KEY); | ||
| await act(async () => { | ||
| await i18n.changeLanguage('en'); | ||
| }); | ||
| }); | ||
|
|
||
| it.each(START_IDS)('shows a zh-CN label for %s with no English left in it', (id) => { | ||
| const key = `podChat.starts.labels.${id}`; | ||
| const zh = i18n.t(key, { lng: 'zh-CN' }); | ||
| expect(zh).not.toBe(i18n.t(key, { lng: 'en' })); | ||
| // Short product terms such as "pod" may stay in Latin letters; longer English words may not. | ||
| expect(zh).not.toMatch(/[A-Za-z]{4,}/); | ||
| }); | ||
|
|
||
| it('keeps the English label Scout reads when the language is English', () => { | ||
| expect(i18n.t('podChat.starts.labels.connect-agent', { lng: 'en' })).toBe('Connect an agent I already use'); | ||
| expect(i18n.t('podChat.starts.labels.start-pod', { lng: 'en' })).toBe('Start a pod for a project'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.