1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

Merge remote-tracking branches 'remotes/origin/AD-499-whitelabel-prize-with-sluice-as-k' and 'remotes/origin/AD-516-add-ga' into AD-419-decouple-piece-registration-from-

This commit is contained in:
diminator 2015-07-15 15:04:18 +02:00
commit 8953d0bfa7
4 changed files with 26 additions and 7 deletions

View File

@ -41,6 +41,16 @@
<body>
<div id="main"></div>
<!-- Google Analytics tracking code -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-60614729-2', 'auto');
</script>
<!-- Intercom library -->
<script>
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;

View File

@ -52,7 +52,10 @@ class AppGateway {
}
load(type) {
Router.run(getRoutes(type), Router.HistoryLocation, (App) => {
Router.run(getRoutes(type), Router.HistoryLocation, (App, state) => {
if (window.ga) {
window.ga('send', 'pageview');
}
React.render(
<App />,
document.getElementById('main')

View File

@ -104,7 +104,7 @@ let AccountSettings = React.createClass({
show={true}
defaultExpanded={true}>
{content}
<Form
{/*<Form
url={AppConstants.serverUrl + 'api/users/set_language/'}>
<Property
name='language'
@ -121,7 +121,7 @@ let AccountSettings = React.createClass({
</select>
</Property>
<hr />
</Form>
</Form>*/}
</CollapsibleParagraph>
);
}
@ -346,4 +346,4 @@ let APISettings = React.createClass({
}
});
export default SettingsContainer;
export default SettingsContainer;

View File

@ -4,6 +4,14 @@ import languages from '../constants/languages';
import { formatText } from './general_utils';
export function getLang() {
// this is just for testing, as changing the navigator.language wasn't possible
// return 'fr';
return navigator.languages ? navigator.languages[0] :
(navigator.language || navigator.userLanguage);
}
/**
* Is used to translate strings to another language. Basically can be used with C's string format method.
* @param {string} s The string you want to translate
@ -11,9 +19,7 @@ import { formatText } from './general_utils';
* @return {string} The formated string
*/
export function getLangText(s, ...args) {
let lang = navigator.language || navigator.userLanguage;
// this is just for testing, as changing the navigator.language wasn't possible
//ang = 'de';
let lang = getLang();
try {
if(lang in languages) {
return formatText(languages[lang][s], args);