-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/interface clarifications #513
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
Changes from all commits
6edb19f
79d53c8
1dcafb7
a8cf83a
2895e63
9ddf02f
9dea827
7af7b78
e440981
1236e78
c482a9b
164f7fb
d59b9eb
8408b98
54e4d43
e63744b
91ad84b
695f23f
14b38eb
1b563a8
d2a3f8f
fc250c9
be0f64d
e2b0e4d
9929899
5f0daf0
6b665cb
4a10968
11af496
3b0352e
978c0f5
6cf200a
a6a9e83
34900a9
16ee433
f7015a7
a485531
a274d89
17c9c53
5e11728
96a92fd
08440c4
1d71075
1697cfd
0622fe2
925aeee
f343847
c77528c
5f4342b
6e87767
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import HbsI18nLexer from 'handlebars-i18next-parser'; | ||
|
||
const sourceDir = 'src'; | ||
const i18nDir = `${sourceDir}/i18n`; | ||
|
||
export default { | ||
input: [`${sourceDir}/**/*.{t,hb}s`, `!${sourceDir}/**/*-te{mplate,st}.ts`], | ||
output: `${i18nDir}/$LOCALE/$NAMESPACE.json`, | ||
locales: ['en', 'fr'], | ||
resetDefaultValueLocale: 'en', | ||
indentation: 4, | ||
lexers: { | ||
hbs: [HbsI18nLexer], | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<figure class="footer-dh"> | ||
<p>Developed by</p> | ||
<p>{{#i18n 'footer.developed-by'}}Developed by{{/i18n}}</p> | ||
<a href="https://dig.hum.uu.nl" target="_blank"><img class="dhlab" | ||
src="{{static 'image/dighum-logo-blue.svg'}}"></a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we already proactively change the Footer to only include the UU logo and DHLab name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that has been agreed, I suppose we should. I'll defer that to a separate ticket, though. |
||
<div class="footer-project is-pulled-right"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<button type=button class="button is-success"> | ||
<span>Add</span> | ||
<span>{{#i18n 'button.add'}}Add{{/i18n}}</span> | ||
<span class="icon is-small"><i class="fas fa-plus"></i></span> | ||
</button> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<button type=button class="button is-danger"> | ||
<span>Remove</span> | ||
<span>{{#i18n 'button.remove'}}Remove{{/i18n}}</span> | ||
<span class="icon is-small"><i class="fas fa-times"></i></span> | ||
</button> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
import { Deferred } from 'jquery'; | ||
import { constant } from 'lodash'; | ||
import * as i18next from 'i18next'; | ||
import * as languageDetector from 'i18next-browser-languagedetector'; | ||
|
||
import * as french from '../i18n/fr.json'; | ||
import * as english from '../i18n/en/translation.json'; | ||
import * as french from '../i18n/fr/translation.json'; | ||
import channel from '../i18n/radio'; | ||
|
||
const deferred = Deferred(); | ||
const i18nPromise = deferred.promise(); | ||
|
||
i18next.use( | ||
languageDetector | ||
).init({ | ||
fallbackLng: ['en', 'dev'], | ||
resources: { | ||
fr: { | ||
translation: french, | ||
const i18nPromise = new Promise(function(resolve, reject) { | ||
i18next.use( | ||
languageDetector | ||
).init({ | ||
fallbackLng: ['en', 'dev'], | ||
resources: { | ||
en: { | ||
translation: english, | ||
}, | ||
fr: { | ||
translation: french, | ||
}, | ||
}, | ||
}, | ||
}, function(error, t) { | ||
if (error) { | ||
deferred.reject(error); | ||
} else { | ||
deferred.resolve(i18next); | ||
} | ||
}, function(error, t) { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(i18next); | ||
} | ||
}); | ||
}); | ||
|
||
channel.reply('i18next', constant(i18nPromise)); | ||
|
||
export { i18nPromise, i18next }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments should probably go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they are needed to ensure that i18next-parser doesn't purge these keys on the next scan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on this? Why is there a difference in behaviour between commented code and removed code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not outcommented. It's a "clarification" (for the parser) of what the next line means.