Skip to content

Commit

Permalink
add i18n support
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiba committed Aug 8, 2015
1 parent b1da629 commit 777431b
Show file tree
Hide file tree
Showing 92 changed files with 5,910 additions and 13 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
Calculate experience value.

exp calculator for poi
##v1.0.0
init
##v1.1.0
add i18n support
18 changes: 18 additions & 0 deletions assets/i18n/en_US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Basic": "Basic",
"Flagship": "Flagship",
"MVP": "MVP",
"MVP and flagship": "MVP and flagship",
"Exp-calc": "Exp-calc",
"Exp calculator": "Exp calculator",
"Ship": "Ship",
"NULL": "NULL",
"Map": "Map",
"Result": "Result",
"Actual level": "Actual level",
"To next": "To next",
"Goal": "Goal",
"Total exp": "Total exp",
"Per attack": "Per attack",
"Remainder": "Remainder"
}
18 changes: 18 additions & 0 deletions assets/i18n/ja_JP.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Basic": "基礎",
"Flagship": "旗艦",
"MVP": "MVP",
"MVP and flagship": "MVP + 旗艦",
"Exp-calc": "経験値計算機",
"Exp calculator": "経験値計算機",
"Ship": "",
"NULL": "",
"Map": "海域",
"Result": "評価",
"Actual level": "今のレべル",
"To next": "次のレベルまで",
"Goal": "目標のレベル",
"Total exp": "必要経験値",
"Per attack": "1回あたり",
"Remainder": "戦闘回数"
}
18 changes: 18 additions & 0 deletions assets/i18n/zh_CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Basic": "基础",
"Flagship": "旗舰",
"MVP": "MVP",
"MVP and flagship": "MVP和旗舰",
"Exp-calc": "经验计算",
"Exp calculator": "Exp calculator",
"Ship": "舰娘",
"NULL": "",
"Map": "海域",
"Result": "结果",
"Actual level": "目前等级",
"To next": "距离下一级",
"Goal": "目标等级",
"Total exp": "合计经验",
"Per attack": "每场经验",
"Remainder": "剩余场数"
}
41 changes: 28 additions & 13 deletions index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ path = require 'path-extra'
{_ships, $ships, $shipTypes} = window
{Alert, Grid, Col, Input, DropdownButton, Table, MenuItem, Button} = ReactBootstrap

i18n = require './node_modules/i18n'
{__} = i18n

i18n.configure
locales: ['en_US', 'ja_JP', 'zh_CN']
defaultLocale: 'en_US'
directory: path.join(__dirname, 'assets', 'i18n')
updateFiles: false
indent: '\t'
extension: '.json'
i18n.setLocale(window.language)

row = if layout == 'horizonal' then 6 else 3
shipRow = if layout == 'horizonal' then 12 else 5
mapRow = if layout == 'horizonal' then 9 else 5
Expand Down Expand Up @@ -58,7 +70,10 @@ expMap = [
]

expType = [
"普通", "旗舰", "MVP", "旗舰+MVP"
__("Basic"),
__("Flagship"),
__("MVP"),
__("MVP and flagship")
]

getExpInfo = (shipId) ->
Expand All @@ -75,8 +90,8 @@ getExpInfo = (shipId) ->
module.exports =
name: 'ExpCalcView'
priority: 2
displayName: <span><FontAwesome key={0} name='calculator' /> 经验计算</span>
description: '经验值计算界面'
displayName: <span><FontAwesome key={0} name='calculator' />{' ' + __("Exp-calc")}</span>
description: __("Exp calculator")
author: 'Chiba'
link: 'https://github.com/Chibaheit'
version: '1.1.0'
Expand Down Expand Up @@ -159,8 +174,8 @@ module.exports =
<link rel="stylesheet" href={join(relative(ROOT, __dirname), 'assets', 'exp-calc.css')} />
<Grid>
<Col xs={shipRow}>
<Input type="select" label="舰娘" value={@state.lastShipId} onChange={@handleShipChange}>
<option key={0}></option>
<Input type="select" label={__("Ship")} value={@state.lastShipId} onChange={@handleShipChange}>
<option key={0}>{__("NULL")}</option>
{
{$ships} = window
if @state._ships
Expand All @@ -172,41 +187,41 @@ module.exports =
</Input>
</Col>
<Col xs={mapRow}>
<Input type="select" label="海域" onChange={@handleExpMapChange}>
<Input type="select" label={__("Map")} onChange={@handleExpMapChange}>
{
for x, i in expMap
<option key={i} value={expValue[i]}>{x}</option>
}
</Input>
</Col>
<Col xs={rankRow}>
<Input type="select" label="评价" onChange={@handleExpLevelChange}>
<Input type="select" label={__("Result")} onChange={@handleExpLevelChange}>
{
for x, i in expLevel
<option key={i} value={expPercent[i]}>{x}</option>
}
</Input>
</Col>
<Col xs={row}>
<Input type="number" label="目前等级" value={@state.currentLevel} onChange={@handleCurrentLevelChange} />
<Input type="number" label={__("Actual level")} value={@state.currentLevel} onChange={@handleCurrentLevelChange} />
</Col>
<Col xs={row}>
<Input type="number" label="距离下一级" value={@state.nextExp} onChange={@handleNextExpChange} />
<Input type="number" label={__("To next")} value={@state.nextExp} onChange={@handleNextExpChange} />
</Col>
<Col xs={row}>
<Input type="number" label="目标等级" value={@state.goalLevel} onChange={@handleGoalLevelChange} />
<Input type="number" label={__("Goal")} value={@state.goalLevel} onChange={@handleGoalLevelChange} />
</Col>
<Col xs={row}>
<Input type="number" label="总经验" value={@state.totalExp} readOnly />
<Input type="number" label={__("Total exp")} value={@state.totalExp} readOnly />
</Col>
</Grid>
<Table>
<tbody>
<tr key={0}>
<td width="10%"> </td>
<td width="30%"> </td>
<td width="30%">每场经验</td>
<td width="30%">剩余场数</td>
<td width="30%">{__("Per attack")}</td>
<td width="30%">{__("Remainder")}</td>
</tr>
{
for x, i in expType
Expand Down
7 changes: 7 additions & 0 deletions node_modules/i18n/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions node_modules/i18n/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/i18n/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions node_modules/i18n/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 777431b

Please sign in to comment.