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

i18n #5

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<body>
<mcpage-preload>
<img src="./texture/jumpingBlock.gif" />
<p>Loading...</p>
<p>加载中...</p>
lemonorangeapple marked this conversation as resolved.
Show resolved Hide resolved
<div class="progress"><progress value="0" max="0"></progress>&emsp;<span class="loadingCount">0</span> / <span class="loadedCount">0</span></div>
<div class="left"><slot name="loading"><ul></ul></slot></div>
<div class="right"><slot name="loaded"><ul></ul></slot></div>
Expand Down
14 changes: 7 additions & 7 deletions src/UI/pages/CreateNewWorldPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
}
</style>
<div class="container">
<h1>Create New World</h1>
<mc-input id="world-name" placeholder="Enter World Name, Default 'My World'"></mc-input>
<mc-input id="world-seed" placeholder="World Seed, Empty for Random"></mc-input>
<h1>创建新世界</h1>
<mc-input id="world-name" placeholder="输入世界名,默认为:'My World'"></mc-input>
<mc-input id="world-seed" placeholder="世界种子,留空则随机"></mc-input>
<div class="gen-options">
<mc-button id="world-type-btn">World Type:&emsp;<span id="world-type-echo">Normal</span></mc-button>
<mc-button disabled>Trees:&emsp;<span id="tree-echo">On</span></mc-button>
<mc-button id="world-type-btn">World Type:&emsp;<span id="world-type-echo">普通</span></mc-button>
<mc-button disabled>树的生成:&emsp;<span id="tree-echo">打开</span></mc-button>
</div>
<div class="bottom-tools">
<mc-button id="create-new-word">Create New World</mc-button>
<mc-button gotoPage="*pop">Cancel</mc-button>
<mc-button id="create-new-word">创建新世界</mc-button>
<mc-button gotoPage="*pop">取消</mc-button>
</div>
</div>
14 changes: 10 additions & 4 deletions src/UI/pages/CreateNewWorldPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ class CreateNewWorldPage extends Page {
super();
this.typeBtn = this.shadowRoot.getElementById("world-type-btn");
this.typeEcho = this.shadowRoot.getElementById("world-type-echo");
this.typeEcho.data = "normal";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

尽量不用在标准 DOM 的 Element 中添加自定义属性。
请改用在本类中添加属性或方法来完成相应的功能。

this.createBtn = this.shadowRoot.getElementById("create-new-word");
this.worldName = this.shadowRoot.getElementById("world-name");
this.worldSeed = this.shadowRoot.getElementById("world-seed");

this.typeBtn.addEventListener("click", () => {
if (this.typeEcho.innerHTML == "Normal")
this.typeEcho.innerHTML = "Flat";
else this.typeEcho.innerHTML = "Normal";
if (this.typeEcho.innerHTML == "普通") {
this.typeEcho.innerHTML = "超平坦";
this.typeEcho.data = "flat";
}
else {
this.typeEcho.innerHTML = "普通";
this.typeEcho.data = "normal";
}
});

this.createBtn.addEventListener("click", () => {
Expand All @@ -25,7 +31,7 @@ class CreateNewWorldPage extends Page {
worldType: ({
Normal: "pre-classic",
Flat: "flat",
})[this.typeEcho.innerHTML],
})[this.typeEcho.data],
seed,
});
});
Expand Down
16 changes: 8 additions & 8 deletions src/UI/pages/HowToPlayPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
}
</style>
<div class="mc-background" darken><div>
<h1>How to play</h1>
<h1>帮助</h1>
<table>
<tr><td><b>WASD</b></td> <td>Move; Double-click W to Sprint</td></tr>
<tr><td><b>Spacebar</b></td> <td>Jump; Double-click to switch Fly Mode</td></tr>
<tr><td><b>Shift/X</b></td> <td>When Fly Mode is on, causes the player to lose altitude (descend)</td></tr>
<tr><td><b>ESC</b></td> <td>Gives back cursor control</td></tr>
<tr><td><b>E</b></td> <td>Open inventory</td></tr>
<tr><td><b>Left/Right button</b></td> <td>Destroy/Place blocks</td></tr>
<tr><td><b>Scroll</b></td> <td>Scrolls through the Hotbar</td></tr>
<tr><td><b>WASD</b></td> <td>移动,双击W疾行</td></tr>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

分号是一种用于分隔存在一定关系的分句的标点符号,这些关系通常包括并列、转折、承接和因果等,尤其以并列关系为主。另一方面,官方翻译Sprint疾跑。建议改为移动;双击 W 疾跑

<tr><td><b>空格</b></td> <td>跳跃,按两下空格起飞</td></tr>
lemonorangeapple marked this conversation as resolved.
Show resolved Hide resolved
<tr><td><b>Shift/X</b></td> <td>起飞后,可降低高度</td></tr>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议改为在飞行模式中降低高度

<tr><td><b>ESC</b></td> <td>进入菜单</td></tr>
<tr><td><b>E</b></td> <td>打开物品栏</td></tr>
<tr><td><b>左键/右键</b></td> <td>破坏/放置方块</td></tr>
<tr><td><b>滚轮</b></td> <td>切换快捷栏槽位</td></tr>
</table>
<mc-button gotoPage="*pop">Back</mc-button>
</div></div>
6 changes: 3 additions & 3 deletions src/UI/pages/PausePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
</style>
<div>
<mc-button gotoPage="*pop">Resume Game</mc-button>
<mc-button gotoPage="setting">Settings</mc-button>
<mc-button gotoPage="welcome">Quit</mc-button>
<mc-button gotoPage="*pop">回到游戏</mc-button>
<mc-button gotoPage="setting">设置</mc-button>
<mc-button gotoPage="welcome">退出</mc-button>
</div>
2 changes: 1 addition & 1 deletion src/UI/pages/PlayPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
pointer-events: none;
}
</style>
<canvas id="mainCanvas">Your browser does not support canvas. Please upgrade your browser.</canvas>
<canvas id="mainCanvas">你的浏览器不支持canvas,请更新浏览器!</canvas>
<mc-crosshairs></mc-crosshairs>
<mc-move-buttons></mc-move-buttons>
<mc-inventory style="display: none;"></mc-inventory>
Expand Down
10 changes: 5 additions & 5 deletions src/UI/pages/SelectWorldPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
}
</style>
<div class="container">
<h1>Select World</h1>
<h1>选择世界</h1>
<ul id="world-list">
<li>
<span class="world-name">Seed</span>
Expand All @@ -81,9 +81,9 @@ <h1>Select World</h1>
</ul>
<div class="btns">
<!-- <mc-button id="btn-select" gotoPage="play" disabled>Play Selected World</mc-button> -->
<mc-button id="btn-select" disabled>Play Selected World</mc-button>
<mc-button id="btn-del" disabled>Delete</mc-button>
<mc-button gotoPage="create-new-world">Create New World</mc-button>
<mc-button gotoPage="*pop">Cancel</mc-button>
<mc-button id="btn-select" disabled>进入选中的世界</mc-button>
<mc-button id="btn-del" disabled>删除</mc-button>
<mc-button gotoPage="create-new-world">创建新世界</mc-button>
<mc-button gotoPage="*pop">取消</mc-button>
</div>
</div>
4 changes: 2 additions & 2 deletions src/UI/pages/SelectWorldPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class SelectWorldPage extends Page {
.reduce((str, [storageId, world]) => str + `
<li>
<span class="world-name">${world.name}</span>
<span class="create-at">Created - ${timestamp2str(world.createAt)}</span>
<span class="modify-at">Modified - ${timestamp2str(world.modifyAt)}</span>
<span class="create-at">创建于 - ${timestamp2str(world.createAt)}</span>
<span class="modify-at">保存于 - ${timestamp2str(world.modifyAt)}</span>
<span class="world-mode">${world.type}</span>
<span class="storageId">${storageId}</span>
</li>
Expand Down
12 changes: 6 additions & 6 deletions src/UI/pages/SettingPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
}
</style>
<div class="wrapper">
<h1>Options</h1>
<h1>设置</h1>
<!-- <mc-slider id="render-distance" label="Render Distance: " unit=" chunks" step="1"></mc-slider> <mc-button>default</mc-button>
<br /> -->
<mc-slider id="fov" label="FOV: " unit=" °" step="1"></mc-slider> <mc-button>default</mc-button>
<mc-slider id="fov" label="视距: " unit=" " step="1"></mc-slider> <mc-button>default</mc-button>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. mc的官方翻译FOV视野
  2. 请保留视野的单位 °(角度,或者可以翻译成
  3. 请使用中文符号,而不是中英文符号混用!

<br />
<mc-slider id="mouse-sensitivity" unit=" " label="Mouse Sensitivity: " step="1"></mc-slider> <mc-button>default</mc-button>
<mc-slider id="mouse-sensitivity" unit=" " label="鼠标灵敏度: " step="1"></mc-slider> <mc-button>default</mc-button>
<br />
<div class="homepage-blur-group">
<mc-slider id="homepage-blur" label="Homepage Blur: " unit=" px" min="0" step="0.5" max="10" value="3.5"></mc-slider> <mc-button>default</mc-button>
<mc-slider id="homepage-blur" label="主页透明度: " unit=" px" min="0" step="0.5" max="10" value="3.5"></mc-slider> <mc-button>default</mc-button>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此次应为主页模糊度

</div>
<mc-button id="shade-btn">Face-dependent Lighting:&emsp;<span id="shade-echo">OFF</span></mc-button>
<mc-button id="shade-btn">禁用平滑光照:&emsp;<span id="shade-echo">OFF</span></mc-button>
<br/>
<mc-button id="debug-output-btn">Debug output:&emsp;<span id="debug-output-echo">OFF</span></mc-button>
<mc-button id="debug-output-btn">调试输出:&emsp;<span id="debug-output-echo">OFF</span></mc-button>
<br />
<mc-button gotoPage="*pop">Back</mc-button>
</div>
6 changes: 3 additions & 3 deletions src/UI/pages/WelcomePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<img width="512" height="64" src="./texture/title.png" />
<p class="mc-bouncing-text">View in <a href="https://github.com/jerrychan7/WebMC">GitHub!</a></p>
<ul>
<li><mc-button gotoPage="select-world">Start</mc-button></li>
<li><mc-button gotoPage="how-to-play">How to play</mc-button></li>
<li><mc-button gotoPage="setting">Setting</mc-button></li>
<li><mc-button gotoPage="select-world">开始</mc-button></li>
<li><mc-button gotoPage="how-to-play">帮助</mc-button></li>
<li><mc-button gotoPage="setting">设置</mc-button></li>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请在此处添加个按钮,该按钮可以允许用户切换语言:默认显示是英语,用户可以在选择后切换成中文显示。
无法否认,英语是世界上最流行的语言之一,用英语作为默认语言可以使得大多数用户在第一次进入游戏时不会迷茫。
另一方面,已经有很多母语非中文的用户对项目进行了fork,如果默认语言变为中文将会造成不必要的混乱和困扰。
PS:我本来想将README也换成中英双语的,但无奈实在是没时间。我看到有些fork已经对README进行了英语翻译,但质量堪忧。

</ul>
3 changes: 2 additions & 1 deletion src/World/Block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { asyncLoadResByUrl } from "../utils/loadResources.js";
import { textureMipmapByTile, prepareTextureAarray, blockInventoryTexture } from "../processingPictures.js";
import { blockShowNames } from "./BlockShowName.js";


// 用32位储存方块id和data。高16位存data,低16位存id。
Expand Down Expand Up @@ -44,7 +45,7 @@ class Block {
friction = 1,
id = findEmptyIdSlot(),
bd = 0,
showName = blockName.toLowerCase().replace(/_/g, " ").replace(/^\w|\s\w/g, w => w.toUpperCase()),
showName = blockShowNames[blockName],
isLeaves = blockName.endsWith("leaves"),
isGlass = blockName.endsWith("glass"),
isFluid = renderType == Block.renderType.FLUID,
Expand Down
58 changes: 58 additions & 0 deletions src/World/BlockShowName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
var blockShowNames = {
"air": "空气",
"stone": "石头",
"granite": "花岗岩",
"polished_granite": "磨制花岗岩",
"diorite": "闪长岩",
"polished_diorite": "磨制闪长岩",
"andesite": "安山岩",
"polished_andesite": "磨制安山岩",
"grass": "草方块",
"dirt": "泥土",
"cobblestone": "原石",
"oak_wood_planks": "橡木木板",
"spruce_wood_planks": "云杉木板",
"birch_wood_planks": "白桦木板",
"jungle_wood_planks": "丛林木板",
"acacia_wood_planks": "金合欢木板",
"dark_oak_wood_planks": "深色橡木木板",
"oak_sapling": "橡树树苗",
"spruce_sapling": "云杉树苗",
"birch_sapling": "白桦树苗",
"jungle_sapling": "丛林树苗",
"acacia_sapling": "金合欢树苗",
"dark_oak_sapling": "深色橡树树苗",
"bedrock": "基岩",
"water": "水",
"flowing_water": "流动的水",
"lava": "熔岩",
"flowing_lava": "流动的熔岩",
"oak_log": "橡木",
"spruce_log": "云杉木",
"birch_log": "白桦木",
"jungle_log": "丛林木",
"oak_leaves": "橡树树叶",
"spruce_leaves": "云杉树叶",
"birch_leaves": "白桦树叶",
"jungle_leaves": "丛林树叶",
"glass": "玻璃",
"acacia_leaves": "金合欢树叶",
"dark_oak_leaves": "深色橡树树叶",
"dandelion": "蒲公英",
"poppy": "虞美人",
"blue_orchid": "兰花",
"allium": "绒球葱",
"azure_bluet": "蓝花美耳草",
"red_tulip": "红色郁金香",
"orange_tulip": "橙色郁金香",
"white_tulip": "白色郁金香",
"pink_tulip": "粉红色郁金香",
"oxeye_daisy": "滨菊",
"crafting_table": "工作台",
"cactus": "仙人掌",
"glowstone": "萤石"
};

export {
blockShowNames
};
Binary file modified texture/mc-font.ttf
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果可以请标明字体的来源。我本来想用 丁卯点阵字体 来作为本项目的像素字体的,但无奈该字体 实 在 是 太 贵 了!因此我只是简单的解包了非常旧版的mcpe找到了之前的字体(虽然也是非法的,但早期的mcpe本来也是非法的,就睁只眼闭只眼吧)

Copy link
Author

@lemonorangeapple lemonorangeapple May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

字体为GNU unifont点阵字体,使用SIL许可证,其大致意思为:

字体可以与任何软件捆绑、一并再分发和/或一并销售。

Binary file not shown.