locale.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import { store } from './store';
  2. const messages = {
  3. "en": {
  4. "code": "Please enter the verification code",
  5. "code.invalid": "Invalid verification code",
  6. "code.send": "The verification code has been sent",
  7. "continue": "Continue",
  8. "email": "Please enter your email",
  9. "email.failure": "Account and email do not match",
  10. "email.invalid": "Please enter a valid email address",
  11. "forget": "Forgot password?",
  12. "forget.failure": "Failed to reset the password",
  13. "forget.success": "Your password has been successfully reset. You can now use the new password to log in",
  14. "forget.title": "Your HumiHumi Verification Code",
  15. "newpass": "Please enter your new password",
  16. "nick": "Nickname",
  17. "nick.invalid": "Invalid nickname",
  18. "nick.placeholder": "2~14 characters",
  19. "password": "Enter password",
  20. "password.invalid": "Password must be 7 ~ 20 characters long",
  21. "password.placeholder": "7~20 characters",
  22. "repeat": "Please re-enter your password",
  23. "repeat.invalid": "The passwords entered do not match",
  24. "sign-forget": "Set a new password",
  25. "sign-in": "Log In",
  26. "sign-in.invalid": "Invalid username or password, please try again",
  27. "sign-up": "Create Account",
  28. "sign-up.invalid": "Failed to create an account, please try again",
  29. "title": "HumiHumi",
  30. "to-in": "Log In",
  31. "to-up": "Create one",
  32. "username": "Please enter your username",
  33. "username-email": "Username/Email",
  34. "username.forget": "Enter username",
  35. "username.in": "Enter username\n\nCreate one",
  36. "username.invalid.in": "Invalid username",
  37. "username.invalid.up": "Invalid username or already taken by someone else",
  38. "username.placeholder": "5~14 characters",
  39. "username.up": "Create username\n\nLog in",
  40. "welcome.forget": "ฅ●ω●ฅ Welcome to\nHumi Kingdom\nLet's change the password~",
  41. "welcome.in": "ฅ●ω●ฅ Welcome back to\nHumi Kingdom\nLet's continue exploring~",
  42. "welcome.up": "ฅ●ω●ฅ Welcome to\nHumi Kingdom\nLet's start exploring~"
  43. },
  44. "jp": {
  45. "code": "認証コードを入力して下さい",
  46. "code.invalid": "認証コードが間違っています",
  47. "code.send": "認証コードが紐付けしたメールアドレスに送信いたしました",
  48. "continue": "続ける",
  49. "email": "メールアドレスを入力して下さい",
  50. "email.failure": "メールアドレスが間違っています",
  51. "email.invalid": "紐付けしたメールアドレスを入力して下さい",
  52. "forget": "忘れた?",
  53. "forget.failure": "パスワードをリセットできません",
  54. "forget.success": "パスワードをリセットしました",
  55. "forget.title": "HumiHumiの認証コードです",
  56. "newpass": "パスワードを入力",
  57. "nick": "ニックネームを入力",
  58. "nick.invalid": "ニックネームが無効です",
  59. "nick.placeholder": "2~14文字",
  60. "password": "パスワードを入力",
  61. "password.invalid": "パスワードは7文字以上20文字以下で入力してください",
  62. "password.placeholder": "7~20文字",
  63. "repeat": "パスワードを再入力",
  64. "repeat.invalid": "再度入力したパスワードが設定したパスワードと一致しません",
  65. "sign-forget": "新たなパスワードを設置する",
  66. "sign-in": "ログイン",
  67. "sign-in.invalid": "ユーザー名またはパスワードが間違っています、もう一度お試しください",
  68. "sign-up": "アカウントを作成する",
  69. "sign-up.invalid": "アカウントの作成に失敗しました、もう一度お試しください",
  70. "title": "HumiHumi",
  71. "to-in": "ログイン",
  72. "to-up": "登録",
  73. "username": "アカウントを入力",
  74. "username-email": "ユーザ名/E-mail",
  75. "username.forget": "ユーザー名を入力",
  76. "username.in": "ユーザー名を入力\n持ってない?\n登録",
  77. "username.invalid.in": "ユーザー名が無効です",
  78. "username.invalid.up": "ユーザー名が無効、または既に他の人に使用されています",
  79. "username.placeholder": "5~14文字",
  80. "username.up": "ユーザー名を作る\n持ってる?\nログイン",
  81. "welcome.forget": "ฅ●ω●ฅようこそHumi王国へ\nパスワードをリセットしましょう~",
  82. "welcome.in": "ฅ●ω●ฅHumi王国へお帰りなさい\n探索を続けましょう",
  83. "welcome.up": "ฅ●ω●ฅHumi王国へようこそ\n探索を始めましょう"
  84. },
  85. "zh": {
  86. "code": "请输入验证码",
  87. "code.invalid": "无效的验证码",
  88. "code.send": "验证码已发送到绑定的邮箱",
  89. "continue": "继续",
  90. "email": "请输入绑定的Email",
  91. "email.failure": "账号与Email不匹配",
  92. "email.invalid": "请输入有效的Email地址",
  93. "forget": "忘记密码?",
  94. "forget.failure": "密码重置失败",
  95. "forget.success": "密码已重置,您可以使用新密码登录了",
  96. "forget.title": "您的HumiHumi验证码",
  97. "newpass": "请输入您的新密码",
  98. "nick": "请输入您的昵称",
  99. "nick.invalid": "昵称无效",
  100. "nick.placeholder": "2~14个字符",
  101. "password": "请输入您的密码",
  102. "password.invalid": "密码长度需要7~20个字符",
  103. "password.placeholder": "7~20个字符",
  104. "repeat": "请再次输入您的密码",
  105. "repeat.invalid": "再次输入的密码与您设置的密码不一致",
  106. "sign-forget": "设置新密码",
  107. "sign-in": "登录",
  108. "sign-in.invalid": "用户名或密码错误,请重试",
  109. "sign-up": "创建账号",
  110. "sign-up.invalid": "账号创建失败,请重试",
  111. "title": "Humi虎咪",
  112. "to-in": "登录",
  113. "to-up": "注册",
  114. "username": "请输入您的账号",
  115. "username-email": "用户名/邮箱",
  116. "username.forget": "请输入您的账号",
  117. "username.in": "请输入您的账号\n还没有账号?\n注册",
  118. "username.invalid.in": "用户名无效",
  119. "username.invalid.up": "用户名无效或已被其他人使用",
  120. "username.placeholder": "5~14个字符",
  121. "username.up": "请创建您的账号\n已有账号?\n登录",
  122. "welcome.forget": "ฅ●ω●ฅ欢迎来到Humi王国\n让我们修改密码吧~",
  123. "welcome.in": "ฅ●ω●ฅ欢迎回到Humi王国\n让我们继续探索吧~",
  124. "welcome.up": "ฅ●ω●ฅ欢迎来到Humi王国\n让我们开始探索吧~"
  125. }
  126. };
  127. const message = (key) => {
  128. return messages[getLang()][key] || '';
  129. }
  130. const getLang = () => {
  131. let language = localStorage.getItem('language') || 'sys';
  132. if (language === 'sys') {
  133. language = navigator.language;
  134. let indexOf = language.indexOf('-');
  135. if (indexOf > -1)
  136. language = language.substring(0, indexOf);
  137. if (!messages[language])
  138. language = 'en';
  139. }
  140. return language;
  141. };
  142. export {
  143. message,
  144. getLang,
  145. }