-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
190 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export default [ | ||
{ | ||
match: "**", | ||
type: "remapColl", | ||
filename: "ExcelBinOutput/DocumentExcelConfigData.json", | ||
}, | ||
{ | ||
match: ">=3.3.0", | ||
remap: { | ||
Id: 'id', | ||
TitleTextMapHash: 'titleTextMapHash', | ||
ContentLocalizedId: 'contentLocalizedId', | ||
PreviewPath: 'previewPath', | ||
VideoPath: 'videoPath', | ||
} | ||
}, | ||
{ | ||
match: "*", | ||
remap: {} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default [ | ||
{ | ||
match: "**", | ||
type: "remapColl", | ||
filename: "ExcelBinOutput/LocalizationExcelConfigData.json", | ||
}, | ||
{ | ||
match: ">=3.3.0", | ||
remap: { | ||
Id: 'id', | ||
AssetType: 'assetType', | ||
DefaultPath: 'defaultPath', | ||
}, | ||
}, | ||
{ | ||
match: "*", | ||
remap: {} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { toPlainObject } from '$lib/util'; | ||
import { inlineLanguage } from "$lib/server/util"; | ||
import { tillCurrentOid, currentOid, find } from '$lib/server/db'; | ||
|
||
export const load: PageLoad = async () => { | ||
const documents = await find('Document', { | ||
_ver: currentOid(), | ||
}); | ||
const d = await Promise.all(documents.map(e => inlineLanguage({...e, _ver: tillCurrentOid()}))); | ||
return { | ||
documents: toPlainObject(d), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script lang="ts"> | ||
import Translated from '$lib/components/Translated.svelte'; | ||
import { lang } from '$lib/client-settings'; | ||
export let data; | ||
let showAll = true; | ||
let filter = ''; | ||
</script> | ||
|
||
<h1>Documents</h1> | ||
<input type="search" class="uk-input uk-margin-top" bind:value={filter} placeholder="Filter"/> | ||
|
||
<table class="uk-table uk-table-small uk-table-striped"> | ||
<tbody> | ||
{#each data.documents as n} | ||
{#if filter.trim() === '' || RegExp(filter).test(n.TitleTextMapHash[$lang]) } | ||
<tr> | ||
<th>{n.Id}</th> | ||
<td><a href={`/document/${n.Id}`}><Translated id={n.TitleTextMapHash} /></a></td> | ||
</tr> | ||
{/if} | ||
{/each} | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { toPlainObject } from '$lib/util'; | ||
import { error } from '@sveltejs/kit'; | ||
import { currentOid, findOne } from "$lib/server/db"; | ||
import { getVersion } from "$lib/server/version"; | ||
import { getFile } from "$lib/server/git"; | ||
import log from 'npmlog'; | ||
|
||
// import { inlineLanguage } from "$lib/server/util"; | ||
|
||
export const load: PageServerLoad = async ({ params }) => { | ||
const id = params.id; | ||
if (!id) throw error(404); | ||
|
||
const document = await findOne('Document', { | ||
_ver: currentOid(), | ||
Id: parseInt(id), | ||
}); | ||
|
||
const content = await findOne('Localization', { | ||
_ver: currentOid(), | ||
Id: document.ContentLocalizedId, | ||
}); | ||
|
||
const path = content.DefaultPath.split('/').slice(-1)[0]; | ||
const text = {}; | ||
try { | ||
const readablePath = (lang, name) => `Readable/${lang}/${name}${lang === 'CHS' ? '' : '_' + lang}.txt`; | ||
const sha = getVersion(); | ||
text['cn'] = (await getFile(readablePath('CHS', path), sha)).toString(); | ||
text['en'] = (await getFile(readablePath('EN', path), sha)).toString(); | ||
text['jp'] = (await getFile(readablePath('JP', path), sha)).toString(); | ||
} catch (e) { | ||
log.error(e); | ||
} | ||
|
||
// const d = await inlineLanguage(document); | ||
return { | ||
document: toPlainObject(document), | ||
content: toPlainObject(content), | ||
text, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script lang="ts"> | ||
import { lang } from '$lib/client-settings'; | ||
import Translated from '$lib/components/Translated.svelte'; | ||
export let data; | ||
</script> | ||
|
||
<h1>Document {data.document.Id}</h1> | ||
<table class="uk-table uk-table-small uk-table-divider"> | ||
<tr> | ||
<th>ContentLocalizedId</th> | ||
<td>{data.document.ContentLocalizedId}</td> | ||
</tr> | ||
<tr> | ||
<th>PreviewPath</th> | ||
<td>{data.document.PreviewPath}</td> | ||
</tr> | ||
<tr> | ||
<th>AssetType</th> | ||
<td>{data.content.AssetType}</td> | ||
</tr> | ||
<tr> | ||
<th>DefaultPath</th> | ||
<td>{data.content.DefaultPath}</td> | ||
</tr> | ||
</table> | ||
<article> | ||
<h5><Translated id={data.document.TitleTextMapHash}/></h5> | ||
<p class="content"> | ||
{#if $lang === 'en'} | ||
{data.text.en}; | ||
{:else if $lang === 'jp'} | ||
{data.text.jp} | ||
{:else}<!-- is chinese --> | ||
{data.text.cn} | ||
{/if} | ||
</p> | ||
</article> | ||
|
||
<style> | ||
.content { | ||
white-space: pre-wrap; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters