Repository navigation
feat(i18n): add Japanese UI locale (日本語) #6986
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
Changes from all commits
c145b72
2765b43
6848504
0897eea
d043a13
673e33a
6bfc61d
f14845d
3a9580f
79cf16e
c261b29
3634df2
1527e92
bab00e2
8fae68a
c8cc3e5
a2d0722
18682a4
82130dc
1da82e2
8b61f81
abfc1d6
acf91a1
4344c23
31ace35
0a460ce
11893b8
6fd6146
3862c78
cd8ccb9
1ff9059
cf2f93e
78790d7
3092dbb
52bf49d
3841ca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { configureStore } from '@reduxjs/toolkit'; | ||
| import { fireEvent, render, screen } from '@testing-library/react'; | ||
| import { Provider } from 'react-redux'; | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| import { I18nProvider, useT } from '../lib/i18n/I18nContext'; | ||
| import localeReducer, { setLocale } from '../store/localeSlice'; | ||
| import LanguageSelect from './LanguageSelect'; | ||
|
|
||
| function LanguageSetting() { | ||
| const { t } = useT(); | ||
| return <span>{t('settings.language')}</span>; | ||
| } | ||
|
|
||
| function renderPicker() { | ||
| const store = configureStore({ reducer: { locale: localeReducer } }); | ||
| store.dispatch(setLocale('en')); | ||
| render( | ||
| <Provider store={store}> | ||
| <I18nProvider> | ||
| <LanguageSelect /> | ||
| <LanguageSetting /> | ||
| </I18nProvider> | ||
| </Provider> | ||
| ); | ||
| return store; | ||
| } | ||
|
|
||
| describe('LanguageSelect', () => { | ||
| it('offers Japanese in its native script and applies it immediately', () => { | ||
| const store = renderPicker(); | ||
| expect(screen.getByRole('option', { name: '🇯🇵 日本語' })).toHaveValue('ja'); | ||
|
|
||
| fireEvent.change(screen.getByRole('combobox'), { target: { value: 'ja' } }); | ||
|
tjm8874 marked this conversation as resolved.
|
||
|
|
||
| expect(store.getState().locale.current).toBe('ja'); | ||
| expect(screen.getByRole('combobox')).toHaveValue('ja'); | ||
| expect(screen.getByText('言語')).toBeInTheDocument(); | ||
| expect(document.documentElement.lang).toBe('ja'); | ||
| expect(document.documentElement.dir).toBe('ltr'); | ||
| }); | ||
|
|
||
| it('can switch back to English after Japanese', () => { | ||
| const store = renderPicker(); | ||
| const picker = screen.getByRole('combobox'); | ||
| fireEvent.change(picker, { target: { value: 'ja' } }); | ||
| fireEvent.change(picker, { target: { value: 'en' } }); | ||
|
|
||
| expect(store.getState().locale.current).toBe('en'); | ||
| expect(picker).toHaveValue('en'); | ||
| expect(screen.getByText('Language')).toBeInTheDocument(); | ||
| expect(document.documentElement.lang).toBe('en'); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -13,6 +13,7 @@ interface LocaleOption { | |||
|
|
||||
| const LOCALE_OPTIONS: LocaleOption[] = [ | ||||
| { value: 'en', flag: '🇬🇧', label: 'English' }, | ||||
| { value: 'ja', flag: '🇯🇵', label: '日本語' }, | ||||
|
tjm8874 marked this conversation as resolved.
tjm8874 marked this conversation as resolved.
tjm8874 marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep unsupported locales out of the default locale list
[RULE] unsupported-locale ·
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Japanese is already in the Locale union at line 14: openhuman/app/src/lib/i18n/types.ts Line 14 in 3092dbb
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved — the reply explains why it is not a problem (advisory), as of If this is wrong, reopen the conversation and say so; the finding will be re-raised on the next push if it still reproduces. |
||||
| { value: 'ko', flag: '🇰🇷', label: '한국어' }, | ||||
| { value: 'zh-CN', flag: '🇨🇳', label: '简体中文' }, | ||||
| { value: 'hi', flag: '🇮🇳', label: 'हिन्दी' }, | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -124,6 +124,28 @@ describe('ComposioPanel', () => { | |||
| expect(screen.getByText(/Managed Composio auth is unavailable here/i)).toBeInTheDocument(); | ||||
| }); | ||||
|
|
||||
| test('renders the direct-only explanation in Japanese for a local session', async () => { | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drive the Japanese Composio direct-only panel in an E2E spec This adds only a mocked component unit test. The repository's testing rule requires frontend flows to have mocked browser/desktop E2E coverage, and this test does not exercise the actual embedded panel, locale selection, or rendered flow in the application shell. Add an E2E spec using the shared helpers that opens the relevant panel in a local session and asserts the Japanese direct-only experience. Additional
|
||||
| test('renders the Japanese Composio direct-only explanation for a local session', async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved — the reply explains why it is not a problem (advisory), as of 3841ca6.
If this is wrong, reopen the conversation and say so; the finding will be re-raised on the next push if it still reproduces.
Uh oh!
There was an error while loading. Please reload this page.