fix: localize simulation description and display A-Copilot in v1.2.18

This commit is contained in:
2026-10-19 14:13:39 +09:00
parent 6512f5fa04
commit 234c9ad467
7 changed files with 53 additions and 6 deletions
+33
View File
@@ -9,6 +9,39 @@ const { createInstance } = require('i18next')
const root = path.resolve(__dirname, '../src/renderer/src')
const dictionary = JSON.parse(fs.readFileSync(path.join(root, 'i18n/en.json'), 'utf8'))
test('only the default simulation description follows language; vehicle and custom text stay unchanged', () => {
const { api } = setup('ko')
const exports = {}
const source = fs.readFileSync(path.join(root, 'features/platforms/PlatformCards.tsx'), 'utf8')
const code = ts.transpileModule(source, { compilerOptions: {
module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022,
jsx: ts.JsxEmit.ReactJSX, esModuleInterop: true
} }).outputText
vm.runInNewContext(code, { exports, require: name => name === '../../i18n'
? { ...api, useLocaleRender() {} } : require(name) })
const { createElement } = require('react')
const { renderToStaticMarkup } = require('react-dom/server')
const description = '내 PC에서 직접 개발 환경을 실행합니다.'
const platform = { id: 'local', platformKey: 'futuredrive-local-pc', title: '로컬 PC', description, state: 'ready' }
const render = value => renderToStaticMarkup(createElement(exports.PlatformOptionCard, {
platform: value, Icon: () => null, dotClassName: '', unavailable: false,
statusPending: false, displayStatus: '사용 가능', primaryAction: '연결',
actionDisabled: false, running: false, onAction() {}, onSettings() {}
}))
assert.ok(render(platform).includes(description))
api.setLanguage('en')
assert.ok(render(platform).includes('Run the development environment directly on this PC.'))
assert.ok(!render(platform).includes(description))
const vehicleDescription = '기초 SLAM 및 자율주행 실습 장비입니다.'
assert.ok(render({ ...platform, platformKey: 'mk-mini', description: vehicleDescription }).includes(vehicleDescription))
assert.ok(render({ ...platform, platformKey: 'mk-mini' }).includes(description))
assert.ok(render({ ...platform, description: '강사가 작성한 시뮬레이션 안내' }).includes('강사가 작성한 시뮬레이션 안내'))
assert.ok(render({ ...platform, description: '설정' }).includes('>설정</p>'))
api.setLanguage('ko')
assert.ok(render(platform).includes(description))
assert.equal(platform.description, description)
})
test('close studio modal translates the built-in Local PC title but preserves vehicle names', () => {
const source = fs.readFileSync(path.join(root, 'App.tsx'), 'utf8')
const expression = source.match(/platformTitle=\{(runningPlatformCloseTarget\.platformKey[^\n]+)\}/)?.[1]