11const params = new URLSearchParams ( window . location . search ) ;
22
33let lang = params . get ( "lang" ) || "ko" ;
4-
54if ( lang !== "ko" && lang !== "en" ) {
65 lang = "ko" ;
76}
87
98const script = document . createElement ( "script" ) ;
10-
119script . src = "https://unpkg.com/blockly/msg/" + lang + ".js" ;
1210
1311script . onload = function ( ) {
1412 initBlockly ( ) ;
1513 applyUILanguage ( ) ;
1614 workspace . updateToolbox ( document . getElementById ( "toolbox" ) ) ;
1715} ;
18-
1916document . head . appendChild ( script ) ;
2017
2118function applyUILanguage ( ) {
2219 if ( lang === "ko" ) {
2320 document . getElementById ( "projectName" ) . placeholder = "프로젝트 이름 입력" ;
24- document . getElementById ( "runButton" ) . textContent = "실행" ;
21+ document . getElementById ( "runButton" ) . textContent = "▶ 실행" ;
22+ document . getElementById ( "saveButton" ) . textContent = "파일로 저장" ;
23+ document . getElementById ( "loadButton" ) . textContent = "파일 불러오기" ;
2524 document . getElementById ( "catBasic" ) . setAttribute ( "name" , "기본" ) ;
2625 document . getElementById ( "catLoop" ) . setAttribute ( "name" , "반복" ) ;
2726 document . getElementById ( "catLogic" ) . setAttribute ( "name" , "논리" ) ;
@@ -32,11 +31,14 @@ function applyUILanguage() {
3231 document . getElementById ( "catFunc" ) . setAttribute ( "name" , "함수" ) ;
3332 document . getElementById ( "catAdvanced" ) . setAttribute ( "name" , "고급 제어" ) ;
3433 document . getElementById ( "catColour" ) . setAttribute ( "name" , "색상" ) ;
34+ document . getElementById ( "catDate" ) . setAttribute ( "name" , "날짜" ) ;
3535 document . getElementById ( "catMint" ) . setAttribute ( "name" , "민트" ) ;
3636 document . getElementById ( "catLocalStorage" ) . setAttribute ( "name" , "로컬 저장소" ) ;
3737 } else {
3838 document . getElementById ( "projectName" ) . placeholder = "Enter project name" ;
39- document . getElementById ( "runButton" ) . textContent = "Run" ;
39+ document . getElementById ( "runButton" ) . textContent = "▶ Run project" ;
40+ document . getElementById ( "saveButton" ) . textContent = "Save to file" ;
41+ document . getElementById ( "loadButton" ) . textContent = "Load file" ;
4042 document . getElementById ( "catBasic" ) . setAttribute ( "name" , "Basic" ) ;
4143 document . getElementById ( "catLoop" ) . setAttribute ( "name" , "Loops" ) ;
4244 document . getElementById ( "catLogic" ) . setAttribute ( "name" , "Logic" ) ;
@@ -47,8 +49,9 @@ function applyUILanguage() {
4749 document . getElementById ( "catFunc" ) . setAttribute ( "name" , "Functions" ) ;
4850 document . getElementById ( "catAdvanced" ) . setAttribute ( "name" , "Advanced" ) ;
4951 document . getElementById ( "catColour" ) . setAttribute ( "name" , "Colour" ) ;
52+ document . getElementById ( "catDate" ) . setAttribute ( "name" , "Date" ) ;
5053 document . getElementById ( "catMint" ) . setAttribute ( "name" , "Mint" ) ;
51- document . getElementById ( "catLocalStorage" ) . setAttribute ( "name" , "localStorage " ) ;
54+ document . getElementById ( "catLocalStorage" ) . setAttribute ( "name" , "LocalStorage " ) ;
5255 }
5356}
5457
7073 localstorage_index : '로컬저장소의 인덱스 번째 데이터를 반환합니다.' ,
7174 localstorage_is_have : '로컬저장소에 해당 키가 존재하는지 여부를 반환합니다.' ,
7275 mint_ip : '사용자의 IP 주소를 반환합니다.' ,
76+
77+ date_picker : "날짜 선택 블록\n\n날짜를 선택할 수 있는 달력 UI를 표시합니다" ,
78+ date_now : "현재 날짜/시간 블록\n\n현재 날짜와 시간을 가져옵니다" ,
79+ date_year : "현재 년도 블록\n\n현재 년도를 가져옵니다" ,
80+ date_month : "현재 월 블록\n\n현재 월을 가져옵니다. (1~12)" ,
81+ date_day : "현재 일 블록\n\n현재 일을 가져옵니다" ,
82+ date_hour : "현재 시 블록\n\n현재 시간(시)을 가져옵니다. (0~23)" ,
83+ date_minute : "현재 분 블록\n\n현재 분을 가져옵니다. (0~59)" ,
84+ date_second : "현재 초 블록\n\n현재 초를 가져옵니다. (0~59)" ,
85+ date_week : "현재 요일 블록\n\n현재 요일을 가져옵니다. (예: 월요일, Tuesday)" ,
7386} ,
7487en : {
7588 mint_wait : "Wait block\n\nPause the program for the given time" ,
@@ -87,6 +100,16 @@ en: {
87100 localstorage_length : 'Return the number of items in localStorage' ,
88101 localstorage_index : 'Return the data at the given index in localStorage' ,
89102 localstorage_is_have : 'Return whether the given key exists in localStorage' ,
103+
104+ date_picker : "Date Picker block\n\nDisplay a calendar UI to select a date" ,
105+ date_now : "Current Date/Time block\n\nGet the current date and time" ,
106+ date_year : "Current Year block\n\nGet the current year" ,
107+ date_month : "Current Month block\n\nGet the current month (1~12)" ,
108+ date_day : "Current Day block\n\nGet the current day" ,
109+ date_hour : "Current Hour block\n\nGet the current hour (0~23)" ,
110+ date_minute : "Current Minute block\n\nGet the current minute (0~59)" ,
111+ date_second : "Current Second block\n\nGet the current second (0~59)" ,
112+ date_week : "Current Weekday block\n\nGet the current weekday (e.g. Monday, 화요일)" ,
90113} } ;
91114
92115// 블록 안에 들어가는 텍스트를 언어별로 정의
@@ -113,6 +136,16 @@ ko: {
113136 localstorage_index_1 : '번째 아이템' ,
114137 localstorage_is_have : '로컬 저장소에' ,
115138 localstorage_is_have_1 : '키가 존재하는가?' ,
139+
140+ date_picker : "날짜:" ,
141+ date_now : "현재 날짜/시간" ,
142+ date_year : "현재 년도" ,
143+ date_month : "현재 월" ,
144+ date_day : "현재 일" ,
145+ date_hour : "현재 시간" ,
146+ date_minute : "현재 분" ,
147+ date_second : "현재 초" ,
148+ date_week : "현재 요일" ,
116149} ,
117150en : {
118151 mint_wait : "Wait for" ,
@@ -136,6 +169,16 @@ en: {
136169 localstorage_index_1 : 'item at index' ,
137170 localstorage_is_have : 'Does localStorage have' ,
138171 localstorage_is_have_1 : 'key?' ,
172+
173+ date_picker : 'date:' ,
174+ date_now : "current date/time" ,
175+ date_year : "current year" ,
176+ date_month : "current month" ,
177+ date_day : "current day" ,
178+ date_hour : "current hour" ,
179+ date_minute : "current minute" ,
180+ date_second : "current second" ,
181+ date_week : "current weekday" ,
139182} } ;
140183
141184// 드롭다운에 표시될 항목을 언어별로 정의
0 commit comments