wip #313
This commit is contained in:
		
							parent
							
								
									abb8e021ba
								
							
						
					
					
						commit
						d850b157f4
					
				
					 5 changed files with 55 additions and 15 deletions
				
			
		|  | @ -1,3 +1,23 @@ | |||
| { | ||||
| 	"common": { | ||||
| 		"time": { | ||||
| 			"unknown": "unknown", | ||||
| 			"future": "future", | ||||
| 			"just_now": "just now", | ||||
| 			"seconds_ago": "{}s ago", | ||||
| 			"minutes_ago": "{}m ago", | ||||
| 			"hours_ago": "{}h ago", | ||||
| 			"days_ago": "{}d ago", | ||||
| 			"weeks_ago": "{}weeks ago", | ||||
| 			"months_ago": "{}months ago", | ||||
| 			"years_ago": "{}years ago" | ||||
| 		} | ||||
| 	}, | ||||
| 	"desktop": { | ||||
| 		"tags": { | ||||
| 			"mk-ui-header-nav": { | ||||
| 				"home": "Home" | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -1,3 +1,23 @@ | |||
| { | ||||
| 	"common": { | ||||
| 		"time": { | ||||
| 			"unknown": "なぞのじかん", | ||||
| 			"future": "未来", | ||||
| 			"just_now": "たった今", | ||||
| 			"seconds_ago": "{}秒前", | ||||
| 			"minutes_ago": "{}分前", | ||||
| 			"hours_ago": "{}時間前", | ||||
| 			"days_ago": "{}日前", | ||||
| 			"weeks_ago": "{}週間前", | ||||
| 			"months_ago": "{}ヶ月前", | ||||
| 			"years_ago": "{}年前" | ||||
| 		} | ||||
| 	}, | ||||
| 	"desktop": { | ||||
| 		"tags": { | ||||
| 			"mk-ui-header-nav": { | ||||
| 				"home": "ホーム" | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -34,16 +34,16 @@ | |||
| 			const now = new Date(); | ||||
| 			const ago = (now - this.time) / 1000/*ms*/; | ||||
| 			this.relative = | ||||
| 				ago >= 31536000 ? ~~(ago / 31536000) + '年前' : | ||||
| 				ago >= 2592000  ? ~~(ago / 2592000)  + 'ヶ月前' : | ||||
| 				ago >= 604800   ? ~~(ago / 604800)   + '週間前' : | ||||
| 				ago >= 86400    ? ~~(ago / 86400)    + '日前' : | ||||
| 				ago >= 3600     ? ~~(ago / 3600)     + '時間前' : | ||||
| 				ago >= 60       ? ~~(ago / 60)       + '分前' : | ||||
| 				ago >= 10       ? ~~(ago % 60)       + '秒前' : | ||||
| 				ago >= 0        ?                      'たった今' : | ||||
| 				ago <  0        ?                      '未来' : | ||||
| 				                                       'なぞのじかん'; | ||||
| 				ago >= 31536000 ? '%i18n:common.time.years_ago%'  .replace('{}', ~~(ago / 31536000)) : | ||||
| 				ago >= 2592000  ? '%i18n:common.time.months_ago%' .replace('{}', ~~(ago / 2592000)) : | ||||
| 				ago >= 604800   ? '%i18n:common.time.weeks_ago%'  .replace('{}', ~~(ago / 604800)) : | ||||
| 				ago >= 86400    ? '%i18n:common.time.days_ago%'   .replace('{}', ~~(ago / 86400)) : | ||||
| 				ago >= 3600     ? '%i18n:common.time.hours_ago%'  .replace('{}', ~~(ago / 3600)) : | ||||
| 				ago >= 60       ? '%i18n:common.time.minutes_ago%'.replace('{}', ~~(ago / 60)) : | ||||
| 				ago >= 10       ? '%i18n:common.time.seconds_ago%'.replace('{}', ~~(ago % 60)) : | ||||
| 				ago >= 0        ? '%i18n:common.time.just_now%' : | ||||
| 				ago <  0        ? '%i18n:common.time.future%' : | ||||
| 				'%i18n:common.time.unknown%'; | ||||
| 			this.update(); | ||||
| 		}; | ||||
| 	</script> | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| 		<li class="home { active: page == 'home' }"> | ||||
| 			<a href={ CONFIG.url }> | ||||
| 				<i class="fa fa-home"></i> | ||||
| 				<p>'i18n:home'</p> | ||||
| 				<p>%i18n:desktop.tags.mk-ui-header-nav.home%</p> | ||||
| 			</a> | ||||
| 		</li> | ||||
| 		<li class="messaging"> | ||||
|  |  | |||
|  | @ -30,11 +30,11 @@ module.exports = (Object as any).entries(languages).map(([lang, locale]) => { | |||
| 			rules: [ | ||||
| 				{ | ||||
| 					enforce: 'pre', | ||||
| 					test: /\.*$/, | ||||
| 					test: /\.(tag|js)$/, | ||||
| 					exclude: /node_modules/, | ||||
| 					loader: StringReplacePlugin.replace({ | ||||
| 						replacements: [ | ||||
| 							{ pattern: /'i18n:(.+?)'/g, replacement: (_, text) => locale[text] } | ||||
| 							{ pattern: /%i18n:(.+?)%/g, replacement: (_, text) => eval('locale' + text.split('.').map(x => `['${x}']`).join('')) } | ||||
| 						] | ||||
| 					}) | ||||
| 				}, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue