Skip to content

Commit

Permalink
change title and new messages notification labels
Browse files Browse the repository at this point in the history
  • Loading branch information
zyuhel committed Dec 18, 2017
1 parent e2f028d commit 2325649
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Adamant.im Messenger</title>
<title>ADAMANT Messenger</title>
<link rel="apple-touch-icon" sizes="180x180" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-16x16.png">
Expand All @@ -23,7 +23,7 @@
<!-- Add to home screen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#4A4A4A">
<meta name="apple-mobile-web-app-title" content="Adamant.im Messenger">
<meta name="apple-mobile-web-app-title" content="ADAMANT Messenger">

<!-- Add to home screen for Windows -->
<meta name="msapplication-TileImage" content="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/mstile-150x150.png">
Expand Down
17 changes: 14 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,28 @@ export default {
window.notify_amount = self.$store.state.totalNewChats
window.notify_interval = setInterval(function () {
if (window.notify_toggle) {
document.title = 'Adamant.im Messenger'
document.title = self.$i18n.t('app_title')
} else {
document.title = window.notify_amount + ' new messages'
var newTitle = ''
if (window.notify_amount % 10 === 1 && window.notify_amount % 100 !== 11) {
newTitle = window.notify_amount + ' ' + self.$i18n.t('new_messages_1')
} else if (window.notify_amount % 10 >= 2 && window.notify_amount % 10 <= 4 && (window.notify_amount % 100 < 10 || window.notify_amount % 100 >= 20)) {
newTitle = window.notify_amount + ' ' + self.$i18n.t('new_messages_2')
} else {
newTitle = window.notify_amount + ' ' + self.$i18n.t('new_messages_5')
}
document.title = newTitle
}
window.notify_toggle = !window.notify_toggle
}, 1000)
}
} else {
if (window.notify_interval) {
clearInterval(window.notify_interval)
document.title = 'Adamant.im Messenger'
document.title = self.$i18n.t('app_title')
}
if (document.title !== self.$i18n.t('app_title')) {
document.title = self.$i18n.t('app_title')
}
}
self.updateCurrentValues()
Expand Down
1 change: 1 addition & 0 deletions src/components/Options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default {
'language' (to, from) {
this.$i18n.locale = to
this.$store.commit('change_lang', to)
document.title = this.$i18n.t('app_title')
}
},
data () {
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export default {
'title': 'English',
'app_title': 'ADAMANT Messenger',
'new_messages_1': 'new message',
'new_messages_2': 'new messages',
'new_messages_5': 'new messages',
'region': 'en-US',
'login': {
'password_label': 'Input your passphrase to login',
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/ru.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export default {
'title': 'Русский',
'app_title': 'АДАМАНТ Мессенджер',
'new_messages_1': 'новое сообщение',
'new_messages_2': 'новых сообщения',
'new_messages_5': 'новых сообщений',
'region': 'ru-RU',
'login': {
'password_label': 'Введите пароль, чтобы войти',
Expand Down
2 changes: 2 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ var i18n = new VueI18n({
messages // set locale messages
})

document.title = i18n.t('app_title')

/* eslint-disable no-new */
window.ep = new Vue({
el: '#app',
Expand Down

0 comments on commit 2325649

Please sign in to comment.