File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ export default Vue.extend({
80
80
.registerClass ({
81
81
schoolName: this .schoolName ,
82
82
className: this .className ,
83
+ locale: this .$i18n .locale ,
83
84
})
84
85
.then (() => {
85
86
this .loading = false
Original file line number Diff line number Diff line change @@ -81,9 +81,22 @@ const VuexModule = createModule({
81
81
target : 'nuxt' ,
82
82
} )
83
83
84
- const generateUniqueId = ( ) : string => {
85
- const c =
86
- 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん'
84
+ const generateUniqueId = ( locale : string ) : string => {
85
+ let c : string = ''
86
+ switch ( locale ) {
87
+ case 'ja' :
88
+ c =
89
+ 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん'
90
+ break
91
+ case 'en' :
92
+ c = 'abcdefghijklmnopqrstuvwxyz'
93
+ break
94
+ case 'zh-tw' :
95
+ c =
96
+ 'ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄧㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦ'
97
+ break
98
+ }
99
+
87
100
const cl = c . length
88
101
const result =
89
102
c [ Math . floor ( Math . random ( ) * cl ) ] +
@@ -237,17 +250,19 @@ export class ClassDataStore extends VuexModule implements classData.ClassData {
237
250
public async registerClass ( {
238
251
className,
239
252
schoolName,
253
+ locale,
240
254
} : {
241
255
className : string
242
256
schoolName : string
257
+ locale : string
243
258
} ) {
244
259
if ( ! vxm . user . isAuthenticated ) {
245
260
throw new Error ( 'ユーザーが正しくログインされていません' )
246
261
}
247
262
248
263
let classId , classObject
249
264
do {
250
- classId = generateUniqueId ( )
265
+ classId = generateUniqueId ( locale )
251
266
try {
252
267
const result = ( await API . graphql ( {
253
268
query : getClassSimple ,
You can’t perform that action at this time.
0 commit comments