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

Japanese #289

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 17 additions & 0 deletions client/entry.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
Meteor.startup ->

##FIXME - clashes with app config
## also we have config in client and server files

# Accounts.ui.config
# passwordSignupFields: 'EMAIL_ONLY'

AccountsEntry.config
homeRoute: '/'
dashboardRoute: '/dashboard'
language: 'en'
showSignupCode: false


AccountsEntry =
settings:
logo: "/images/ux/logo/logo.png"
wrapLinks: true
homeRoute: '/home'
dashboardRoute: '/dashboard'
Expand All @@ -9,6 +25,7 @@ AccountsEntry =
entrySignUp: '/sign-up'
extraSignUpFields: []
showOtherLoginServices: true
language: "en"

isStringEmail: (email) ->
emailPattern = /^([\w.-]+)@([\w.-]+)\.([a-zA-Z.]{2,6})$/i
Expand Down
43 changes: 43 additions & 0 deletions client/t9n/japanese.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ja =
signIn: "ログイン"
signin: "ログイン"
signOut: "ログアウト"
signUp: "登録"
OR: "OR"
forgotPassword: "パスワード忘れた?"
emailAddress: "メールアドレス"
emailResetLink: "メールリセット"
dontHaveAnAccount: "まだ登録していない?"
resetYourPassword: "パスワードリセット"
updateYourPassword: "パスワード更新"
password: "パスワード"
usernameOrEmail: "ユーザー名前かメールアドレス"
email: "メールアドレス"
ifYouAlreadyHaveAnAccount: "既に登録している方"
signUpWithYourEmailAddress: "メールアドレスで登録する"
username: "ユーザー名"
optional: "随意"
signupCode: "登録コード"
clickAgree: "登録をクリックすると、規約に同意する"
privacyPolicy: "プライバシー規約"
terms: "利用契約"
sign: "サイン"
configure: "設定"
with: ":"
createAccount: "新規登録"
and: "と"
"Match failed": "Match failed"
"User not found": "ユーザーが見つからない"

error:
minChar: "7文字が必要"
pwOneLetter: "アルファベット文字が必要"
pwOneDigit: "パスワードに数字が必要"
usernameRequired: "ユーザー名が必要"
emailRequired: "めーるアドレスが必要"
signupCodeRequired: "登録コードが必要."
signupCodeIncorrect: "登録コードの誤りがあるようです"
signInRequired: "ログインが必要"
usernameIsEmail: "ユーザー名ではメアドレスは使えない"

T9n.map "ja", ja
15 changes: 12 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
Package.describe({
summary: "Make signin and signout their own pages with routes.",
version: '0.9.0',
git: 'https://github.com/Differential/accounts-entry'
// git: 'https://github.com/Differential/accounts-entry',
// name: "joshowens:accounts-entry"

git: 'https://github.com/dcsan/accounts-entry',
name: "dcsan:accounts-entry"
});

Package.onUse(function(api) {
api.versionsFrom("[email protected]");

// console.log('- onUse: accounts-entry ')

// CLIENT
api.use([
'deps',
Expand All @@ -17,7 +23,7 @@ Package.onUse(function(api) {
'handlebars',
'session',
'coffeescript',
'simple-form',
// 'joshowens:simple-form',
'less',
'sha']
, 'client');
Expand Down Expand Up @@ -55,7 +61,8 @@ Package.onUse(function(api) {
'client/t9n/portuguese.coffee',
'client/t9n/slovene.coffee',
'client/t9n/russian.coffee',
'client/t9n/arabic.coffee'
'client/t9n/arabic.coffee',
'client/t9n/japanese.coffee'
], 'client');

// SERVER
Expand All @@ -72,6 +79,8 @@ Package.onUse(function(api) {

// CLIENT and SERVER
api.imply('accounts-base', ['client', 'server']);
api.imply('accounts-twitter', ['client', 'server']);
api.imply('accounts-facebook', ['client', 'server']);
api.imply('accounts-password', ['client', 'server']);
api.export('AccountsEntry', ['client', 'server']);
api.use(['iron:router', 'mrt:accounts-t9n'], ['client', 'server']);
Expand Down
13 changes: 9 additions & 4 deletions server/entry.coffee
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
Meteor.startup ->
Accounts.urls.resetPassword = (token) ->
Meteor.absoluteUrl('reset-password/' + token)

AccountsEntry =
settings: {}

config: (appConfig) ->
@settings = _.extend(@settings, appConfig)

@AccountsEntry = AccountsEntry

# if Meteor.isServer
# AccountsEntry.config
# signupCode: null

Accounts.urls.resetPassword = (token) ->
Meteor.absoluteUrl('reset-password/' + token)


Meteor.methods
entryValidateSignupCode: (signupCode) ->
check signupCode, Match.OneOf(String, null, undefined)
Expand All @@ -29,5 +33,6 @@ Meteor.startup ->
email: user.email
password: user.password
profile: _.extend(profile, user.profile)

if (user.email && Accounts._options.sendVerificationEmail)
Accounts.sendVerificationEmail(userId, user.email)
177 changes: 91 additions & 86 deletions shared/router.coffee
Original file line number Diff line number Diff line change
@@ -1,86 +1,91 @@
Router.map ->

@route "entrySignIn",
path: "/sign-in"
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'in')
onRun: ->
if Meteor.userId()
Router.go AccountsEntry.settings.dashboardRoute

if AccountsEntry.settings.signInTemplate
@template = AccountsEntry.settings.signInTemplate

# If the user has a custom template, and not using the helper, then
# maintain the package Javascript so that OpenGraph tags and share
# buttons still work.
pkgRendered= Template.entrySignIn.rendered
userRendered = Template[@template].rendered

if userRendered
Template[@template].rendered = ->
pkgRendered.call(@)
userRendered.call(@)
else
Template[@template].rendered = pkgRendered

Template[@template].events(AccountsEntry.entrySignInEvents)
Template[@template].helpers(AccountsEntry.entrySignInHelpers)


@route "entrySignUp",
path: "/sign-up"
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'up')
onRun: ->
if AccountsEntry.settings.signUpTemplate
@template = AccountsEntry.settings.signUpTemplate

# If the user has a custom template, and not using the helper, then
# maintain the package Javascript so that OpenGraph tags and share
# buttons still work.
pkgRendered= Template.entrySignUp.rendered
userRendered = Template[@template].rendered

if userRendered
Template[@template].rendered = ->
pkgRendered.call(@)
userRendered.call(@)
else
Template[@template].rendered = pkgRendered

Template[@template].events(AccountsEntry.entrySignUpEvents)
Template[@template].helpers(AccountsEntry.entrySignUpHelpers)


@route "entryForgotPassword",
path: "/forgot-password"
onBeforeAction: ->
Session.set('entryError', undefined)

@route 'entrySignOut',
path: '/sign-out'
onBeforeAction: (pause)->
Session.set('entryError', undefined)
if AccountsEntry.settings.homeRoute
Meteor.logout () ->
Router.go AccountsEntry.settings.homeRoute
pause()

@route 'entryResetPassword',
path: 'reset-password/:resetToken'
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('resetToken', @params.resetToken)

# Get all the accounts-entry routes one time
exclusions = [];
_.each Router.routes, (route)->
exclusions.push route.name
# Change the fromWhere session variable when you leave a path
Router.onStop ->
# If the route is an entry route, no need to save it
if (!_.contains(exclusions, Router.current().route.name))
Session.set('fromWhere', Router.current().path)
if Meteor.isClient # don't break server routes with @current

# Get all the accounts-entry routes one time
exclusions = [];
_.each Router.routes, (route)->
exclusions.push route.name
# Change the fromWhere session variable when you leave a path

Router.onStop ->
# If the route is an entry route, no need to save it
if (!_.contains(exclusions, Router.current().route.name))
Session.set('fromWhere', Router.current().path)

Router.map ->

@route "entrySignIn",
path: "/sign-in"
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'in')
onRun: ->
if Meteor.userId()
Router.go AccountsEntry.settings.dashboardRoute

if AccountsEntry.settings.signInTemplate
@template = AccountsEntry.settings.signInTemplate

# If the user has a custom template, and not using the helper, then
# maintain the package Javascript so that OpenGraph tags and share
# buttons still work.
pkgRendered= Template.entrySignIn.rendered
userRendered = Template[@template].rendered

if userRendered
Template[@template].rendered = ->
pkgRendered.call(@)
userRendered.call(@)
else
Template[@template].rendered = pkgRendered

Template[@template].events(AccountsEntry.entrySignInEvents)
Template[@template].helpers(AccountsEntry.entrySignInHelpers)


@route "entrySignUp",
path: "/sign-up"
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'up')
onRun: ->
if AccountsEntry.settings.signUpTemplate
@template = AccountsEntry.settings.signUpTemplate

# If the user has a custom template, and not using the helper, then
# maintain the package Javascript so that OpenGraph tags and share
# buttons still work.
pkgRendered= Template.entrySignUp.rendered
userRendered = Template[@template].rendered

if userRendered
Template[@template].rendered = ->
pkgRendered.call(@)
userRendered.call(@)
else
Template[@template].rendered = pkgRendered

Template[@template].events(AccountsEntry.entrySignUpEvents)
Template[@template].helpers(AccountsEntry.entrySignUpHelpers)


@route "entryForgotPassword",
path: "/forgot-password"
onBeforeAction: ->
Session.set('entryError', undefined)

@route 'entrySignOut',
path: '/sign-out'
onBeforeAction: (pause)->
Session.set('entryError', undefined)
if AccountsEntry.settings.homeRoute
Meteor.logout () ->
Router.go AccountsEntry.settings.homeRoute
pause()

@route 'entryResetPassword',
path: 'reset-password/:resetToken'
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('resetToken', @params.resetToken)


Loading