Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/viewer/src/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import loadString from './string'
import printFrame from './utils/print'

class Header {
Expand Down Expand Up @@ -159,7 +160,7 @@ class Header {
title.appendChild(link)

const description = document.createElement('p')
description.textContent = '본 제품은 한글과컴퓨터의 한/글 문서 파일(.hwp) 공개 문서를 참고하여 개발하였습니다.'
description.textContent = loadString('about')

const copyright = document.createElement('p')
copyright.textContent = 'Copyright 2020 Han Lee <[email protected]> and other contributors.'
Expand Down Expand Up @@ -197,7 +198,7 @@ class Header {
this.pageNumber.textContent = '1'

const totalPages = document.createElement('span')
totalPages.textContent = `/${this.pages.length}`
totalPages.textContent = `/${this.pages.length}${loadString('page')}`

this.container.appendChild(this.pageNumber)
this.container.appendChild(totalPages)
Expand Down
16 changes: 16 additions & 0 deletions packages/viewer/src/string/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const supportedLanguages = ['ko', 'en-US']
const defaultLanguage = 'en-US'

import {default as Korean} from "./translation/ko.json"
import {default as English} from "./translation/english.json"

const strings = {
"ko": Korean,
"en-US": English
} as any

export default function loadString(key: string) {
let language = window.navigator.language
if (!supportedLanguages.includes(language)) language = defaultLanguage
return strings[language][key]
}
4 changes: 4 additions & 0 deletions packages/viewer/src/string/translation/english.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"page": " page",
"about": "This product is developed by referring to the HANCOM Group's Hangul Document File (.hwp) public documentation."
}
4 changes: 4 additions & 0 deletions packages/viewer/src/string/translation/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"page": "쪽",
"about": "본 제품은 한글과컴퓨터의 한/글 문서 파일(.hwp) 공개 문서를 참고하여 개발하였습니다."
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./build",
"resolveJsonModule": true,
"lib": [
"es2017",
"dom",
Expand Down