feat: localize teaching monitoring
This commit is contained in:
1 parent
4ed7de7502
commit
6c30069457
4 files changed
+72
-53
No files matched your search
@@ -24,6 +24,12 @@ const hardcoded = completedViews.filter((name) => {
|
||||
if (name === 'BaseDataView.vue') source = source.replace("degreeType: '学士'", '').replace("roomType: '普通教室'", '')
|
||||
return /\p{Script=Han}/u.test(source)
|
||||
})
|
||||
// Teaching monitoring still recognizes Chinese reason strings from the API;
|
||||
// its template itself should contain only translated interface copy.
|
||||
const monitoringSource = readFileSync(new URL('../src/views/TeachingMonitoringView.vue', import.meta.url), 'utf8')
|
||||
if (/\p{Script=Han}/u.test(monitoringSource.split('<template>')[1]?.split('</template>\n\n<style')[0] ?? '')) {
|
||||
hardcoded.push('TeachingMonitoringView.vue')
|
||||
}
|
||||
const viewsDirectory = new URL('../src/views/', import.meta.url)
|
||||
const fixedLocaleViews = readdirSync(viewsDirectory).filter((name) => name.endsWith('.vue') &&
|
||||
/(?:toLocale(?:Date|Time)?String|DateTimeFormat|NumberFormat|Collator)\(['"]zh-CN['"]/.test(readFileSync(new URL(name, viewsDirectory), 'utf8')))
|
||||
|
||||
Reference in new issue
Block a user