HelloZeroNet / HelloZeroNet/ZeroNet
ZeroNet's --debug mode Automatic CoffeeScript -> JavaScript conversion not friendly of i18n
- 主要言語
- JavaScript
- スター
- 18.8k
- フォーク
- 2.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
coffee script not friendly of i18n, like that:
```
class Time
since: (time) ->
now = +(new Date) / 1000
secs = now - time
if secs < 60
back = "Just now"
else if secs < 60 * 60
back = "#{Math.round(secs / 60)} minutes ago"
else if secs < 60 * 60 * 24
back = "#{Math.round(secs / 60 / 60)} hours ago"
else if secs < 60 * 60 * 24 * 3
back = "#{Math.round(secs / 60 / 60 / 24)} days ago"
else
back = "on " + @date(time)
back = back.replace(/1 ([a-z]+)s/, "1 $1") # 1 days ago fix
return back
date: (timestamp, format = "short") ->
parts = new Date(timestamp * 1000)
if format == "short"
display = (parts.getFullYear() + "nian" + String(parts.getMonth() + 1) + "yue" + parts.getDay() + "ri")
else
display = parts.toTimeString()
return display
timestamp: (date = "") ->
if date == "now" or date == ""
return parseInt(+(new Date) / 1000)
else
return parseInt(Date.parse(date) / 1000)
# Get elistamated read time for post
readtime: (text) ->
chars = text.length
if chars > 1500
return parseInt(chars / 1500) + " min read"
else
return "less than 1 min read"
window.Time = new Time
```
success

but if I change it to Chinese...BOOM.
```
class Time
since: (time) ->
now = +(new Date) / 1000
secs = now - time
if secs < 60
back = "刚才"
else if secs < 60 * 60
back = "#{Math.round(secs / 60)} 分钟前"
else if secs < 60 * 60 * 24
back = "#{Math.round(secs / 60 / 60)} 小时前"
else if secs < 60 * 60 * 24 * 3
back = "#{Math.round(secs / 60 / 60 / 24)} 天之前"
else
back = "on " + @date(time)
back = back.replace(/1 ([a-z]+)s/, "1 $1") # 1 days ago fix
return back
date: (timestamp, format = "short") ->
parts = new Date(timestamp * 1000)
if format == "short"
display = (parts.getFullYear() + "年" + String(parts.getMonth() + 1) + "月" + parts.getDay() + "日")
else
display = parts.toTimeString()
return display
timestamp: (date = "") ->
if date == "now" or date == ""
return parseInt(+(new Date) / 1000)
else
return parseInt(Date.parse(date) / 1000)
# Get elistamated read time for post
readtime: (text) ->
chars = text.length
if chars > 1500
return parseInt(chars / 1500) + " min read"
else
return "less than 1 min read"
window.Time = new Time
```

Um....How to slove it? or ZeroBundle should upgrade Coffee Script?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start with ZeroNet's --debug mode and the automatic CoffeeScript-to-JavaScript conversion path, then reproduce the failure using the Chinese strings shown in the issue. Done means non-ASCII text converts successfully in debug mode without the reported crash or broken output.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- coffeescript, javascript
- 領域
- frontend, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100