Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corel10n #1157

Merged
merged 4 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ js/core/id-headers.js
js/core/include-config.js
js/core/inlines.js
js/core/jquery-enhanced.js
js/core/l10n.js
js/core/location-hash.js
js/core/markdown.js
js/core/override-configuration.js
Expand Down
3 changes: 2 additions & 1 deletion js/profile-w3c-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (document.body) {
} else {
document.addEventListener("DOMContentLoaded", function() {
document.body.hidden = true;
}, {once: true});
}, { once: true });
}

// In case everything else fails, we always want to show the document
Expand Down Expand Up @@ -46,6 +46,7 @@ define([
"core/aria",
"core/style",
"w3c/style",
"core/l10n",
"w3c/l10n",
"core/data-include",
"core/markdown",
Expand Down
129 changes: 129 additions & 0 deletions src/core/l10n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Module w3c/l10n
// Looks at the lang attribute on the root element and uses it to manage the config.l10n object so
// that other parts of the system can localise their text

export const l10n = {
en: {
this_version: "This version:",
latest_published_version: "Latest published version:",
latest_editors_draft: "Latest editor's draft:",
editor: "Editor:",
editors: "Editors:",
author: "Author:",
authors: "Authors:",
abstract: "Abstract",
sotd: "Status of This Document",
toc: "Table of Contents",
note: "Note",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "Fig. ",
bug_tracker: "Bug tracker:",
file_a_bug: "file a bug",
open_bugs: "open bugs",
open_parens: "(",
close_parens: ")"
},
ko: {
this_version: "현재 버전:",
latest_published_version: "최신 버전:",
latest_editors_draft: "Latest editor's draft:",
editor: "Editor:",
editors: "Editors:",
author: "저자:",
authors: "저자:",
abstract: "요약",
sotd: "현재 문서의 상태",
toc: "Table of Contents",
note: "Note",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "그림 ",
bug_tracker: "Bug tracker:",
file_a_bug: "file a bug",
open_bugs: "open bugs",
open_parens: "(",
close_parens: ")"
},
zh: {
this_version: "本版本:",
latest_published_version: "最新发布草稿:",
latest_editors_draft: "最新编辑草稿:",
editor: "编辑:",
editors: "编辑们:",
author: "Author:",
authors: "Authors:",
abstract: "摘要",
sotd: "关于本文档",
toc: "内容大纲",
note: "注",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "圖",
bug_tracker: "错误跟踪:",
file_a_bug: "反馈错误",
open_bugs: "修正中的错误",
open_parens: "(",
close_parens: ")"
},
ja: {
this_version: "このバージョン:",
latest_published_version: "最新バージョン:",
latest_editors_draft: "最新の編集用草案:",
editor: "編者:",
editors: "編者:",
author: "著者:",
authors: "著者:",
abstract: "要約",
sotd: "この文書の位置付け",
toc: "目次",
note: "注",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "図",
bug_tracker: "バグの追跡履歴:",
file_a_bug: "File a bug",
open_bugs: "改修されていないバグ",
open_parens: "(",
close_parens: ")"
},
nl: {
this_version: "Deze versie:",
latest_published_version: "Laatst gepubliceerde versie:",
latest_editors_draft: "Laatste werkversie:",
editor: "Redacteur:",
editors: "Redacteurs:",
author: "Auteur:",
authors: "Auteurs:",
abstract: "Samenvatting",
sotd: "Status van dit document",
toc: "Inhoudsopgave",
note: "Noot",
editors_note: "Redactionele Noot",
example: "Voorbeeld",
issue: "Probleem",
warning: "Waarschuwing",
fig: "Dien een melding in",
bug_tracker: "Meldingensysteem:",
file_a_bug: "Dien een melding in",
open_bugs: "open meldingen",
open_parens: "(",
close_parens: ")"
}
};
l10n["zh-hans"] = l10n.zh;
l10n["zh-cn"] = l10n.zh;

export function run(config, doc, cb) {
var lang = $(doc.documentElement).attr("lang") || "en";
config.l10n = l10n[lang] ? l10n[lang] : l10n.en;
cb();
}
124 changes: 10 additions & 114 deletions src/w3c/l10n.js
Original file line number Diff line number Diff line change
@@ -1,133 +1,29 @@
// Module w3c/l10n
// Looks at the lang attribute on the root element and uses it to manage the config.l10n object so
// that other parts of the system can localise their text
import { l10n } from "core/l10n";

export const l10n = {
const additions = {
en: {
this_version: "This version:",
latest_published_version: "Latest published version:",
latest_editors_draft: "Latest editor's draft:",
editor: "Editor:",
editors: "Editors:",
author: "Author:",
authors: "Authors:",
abstract: "Abstract",
sotd: "Status of This Document",
status_at_publication: "This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href='https://www.w3.org/TR/'>W3C technical reports index</a> at https://www.w3.org/TR/.",
toc: "Table of Contents",
note: "Note",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "Fig. ",
bug_tracker: "Bug tracker:",
file_a_bug: "file a bug",
open_bugs: "open bugs",
open_parens: "(",
close_parens: ")"
},
ko: {
this_version: "현재 버전:",
latest_published_version: "최신 버전:",
latest_editors_draft: "Latest editor's draft:",
editor: "Editor:",
editors: "Editors:",
author: "저자:",
authors: "저자:",
abstract: "요약",
sotd: "현재 문서의 상태",
status_at_publication: "This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href='https://www.w3.org/TR/'>W3C technical reports index</a> at https://www.w3.org/TR/.",
toc: "Table of Contents",
note: "Note",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "그림 ",
bug_tracker: "Bug tracker:",
file_a_bug: "file a bug",
open_bugs: "open bugs",
open_parens: "(",
close_parens: ")"
},
zh: {
this_version: "本版本:",
latest_published_version: "最新发布草稿:",
latest_editors_draft: "最新编辑草稿:",
editor: "编辑:",
editors: "编辑们:",
author: "Author:",
authors: "Authors:",
abstract: "摘要",
sotd: "关于本文档",
status_at_publication: "本章节描述了本文档的发布状态。其它更新版本可能会覆盖本文档。W3C的文档列 表和最新版本可通过<a href='https://www.w3.org/TR/'>W3C技术报告</a>索引访问。",
toc: "内容大纲",
note: "注",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "圖",
bug_tracker: "错误跟踪:",
file_a_bug: "反馈错误",
open_bugs: "修正中的错误",
open_parens: "(",
close_parens: ")"
},
ja: {
this_version: "このバージョン:",
latest_published_version: "最新バージョン:",
latest_editors_draft: "最新の編集用草案:",
editor: "編者:",
editors: "編者:",
author: "著者:",
authors: "著者:",
abstract: "要約",
sotd: "この文書の位置付け",
status_at_publication: "この節には、公開時点でのこの文書の位置づけが記されている。他の文書によって置き換えられる可能性がある。現時点でのW3Cの発行文書とこのテクニカルレポートの最新版は、下記から参照できる。 <a href='https://www.w3.org/TR/'>W3C technical reports index</a> (https://www.w3.org/TR/)",
toc: "目次",
note: "注",
editors_note: "Editor's Note",
example: "Example",
issue: "Issue",
warning: "Warning",
fig: "図",
bug_tracker: "バグの追跡履歴:",
file_a_bug: "File a bug",
open_bugs: "改修されていないバグ",
open_parens: "(",
close_parens: ")"
},
nl: {
this_version: "Deze versie:",
latest_published_version: "Laatst gepubliceerde versie:",
latest_editors_draft: "Laatste werkversie:",
editor: "Redacteur:",
editors: "Redacteurs:",
author: "Auteur:",
authors: "Auteurs:",
abstract: "Samenvatting",
sotd: "Status van dit document",
toc: "Inhoudsopgave",
note: "Noot",
editors_note: "Redactionele Noot",
example: "Voorbeeld",
issue: "Probleem",
warning: "Waarschuwing",
fig: "Dien een melding in",
bug_tracker: "Meldingensysteem:",
file_a_bug: "Dien een melding in",
open_bugs: "open meldingen",
open_parens: "(",
close_parens: ")"
}
status_at_publication: "This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href='https://www.w3.org/TR/'>W3C technical reports index</a> at https://www.w3.org/TR/.",
},
};
l10n["zh-hans"] = l10n.zh;
l10n["zh-cn"] = l10n.zh;

export function run(config, doc, cb) {
var lang = $(doc.documentElement).attr("lang") || "en";
config.l10n = l10n[lang] ? l10n[lang] : l10n.en;
cb();
}
Object
.keys(additions)
.reduce((l10n, key) => {
Object.assign(l10n[key], additions[key]);
return l10n;
}, l10n);