Skip to content

Commit

Permalink
Merge pull request #4 from thomassth/build-error-fix
Browse files Browse the repository at this point in the history
Build error fix by Thomas.
I assume `Bad Gateway error` is network issue caused by other reason and this pull request aimed to fix a build error. Since Jamie was able to build, I consider this fix valid.
  • Loading branch information
NewJerseyStyle authored Sep 13, 2024
2 parents 85ce00f + c158f05 commit 17da67a
Show file tree
Hide file tree
Showing 14 changed files with 551 additions and 202 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Polis

Polis is an AI powered sentiment gathering platform. More organic than surveys and less effort than focus groups, Polis meets the basic human need to be understood, at scale.
Polis is an AI powered sentiment gathering platform. More organic than surveys and less effort than focus groups.

For a detailed methods paper, see [Polis: Scaling Deliberation by Mapping High Dimensional Opinion Spaces][methods-paper].

Expand Down
19 changes: 7 additions & 12 deletions client-participation/js/routers/main-polis-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var Backbone = require("backbone");
var bbFetch = require("../net/bbFetch");
var ConversationModel = require("../models/conversation");
var eb = require("../eventBus");
// var gaEvent = require("../util/gaMetric").gaEvent;
var metric = require("../util/gaMetric");
var ParticipantModel = require("../models/participant");
var ParticipationView = require("../views/participation");
Expand All @@ -15,23 +14,20 @@ var preloadHelper = require("../util/preloadHelper");
var RootView = require("../views/root");
var Constants = require("../util/constants");
var SettingsView = require("../views/settings.js");

var UserModel = require("../models/user");
var Utils = require("../util/utils");
var hasEmail = require("../util/polisStorage").hasEmail;


var match = window.location.pathname.match(/ep1_[0-9A-Za-z]+$/);
var encodedParams = match ? match[0] : void 0;

var routeEvent = metric.routeEvent;

var authenticatedDfd = $.Deferred();
authenticatedDfd.done(function() {
// link uid to GA userId
// link uid to GA user_id
// TODO update this whenever auth changes
if (Constants.GA_TRACKING_ID) {
gtag('set', 'userId', PolisStorage.uid() || PolisStorage.uidFromCookie());
const userId = PolisStorage.uid() || PolisStorage.uidFromCookie();
gtag('set', 'user_properties', {'user_id': userId});
}
});

Expand Down Expand Up @@ -85,11 +81,10 @@ var polisRouter = Backbone.Router.extend({
}

}, // end initialize
r: function(pattern, methodNameToCall) {
var that = this;
this.route(pattern, function() {
routeEvent(methodNameToCall, arguments);
that[methodNameToCall].apply(that, arguments);
r(pattern, methodNameToCall) {
this.route(pattern, (...args) => {
metric.routeEvent(methodNameToCall, args);
this[methodNameToCall].apply(this, args);
});
},
bail: function() {
Expand Down
155 changes: 67 additions & 88 deletions client-participation/js/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,59 @@ var preloadHelper = require("./util/preloadHelper");
var Utils = require("./util/utils");

var translations = {
en_us: require("./strings/en_us.js"),
// ja: require("./strings/ja.js"),

// zh-Hant is Traditional Chinese (TW, MO and HK can use the same file.)
zh_Hant: require("./strings/zh_Hant.js"),

// zh-Hans is Simplified Chinese. (CN, SG and MY can use the same file.)
zh_Hans: require("./strings/zh_Hans.js"),

// Arabic
ar: require("./strings/ar.js"),
// Welsh
cy: require("./strings/cy.js"),
// Danish
da: require("./strings/da_dk.js"),

// German
de: require("./strings/de_de.js"),

// Greek
el: require("./strings/gr.js"),
// English
en_us: require("./strings/en_us.js"),
// Spanish
es: require("./strings/es_la.js"),

// Farsi
fa: require("./strings/fa.js"),

// French
fr: require("./strings/fr.js"),

// Frisian
fy: require("./strings/fy_nl.js"),
// Hebrew
he: require("./strings/he.js"),
// Croatian
hr: require("./strings/hr.js"),
// Italian
it: require("./strings/it.js"),

// Japanese
ja: require("./strings/ja.js"),
// Dutch
nl: require("./strings/nl.js"),

// Portuguese
// Brazilian Portuguese (all portuguese speakers are temporarily using the same file.)
pt_br: require("./strings/pt_br.js"),

// Japanese
ja: require("./strings/ja.js"),

// Croatian
hr: require("./strings/hr.js"),

// Portuguese (Timor-Leste)
// pt_tl: require("./strings/pt_tl.js"),
// Romanian & Moldovan
ro: require("./strings/ro.js"),
// Russian
ru: require("./strings/ru.js"),
// Slovak
sk: require("./strings/sk.js"),

// Hebrew
he: require("./strings/he.js"),

// Welsh
cy: require("./strings/cy.js"),

// Greek
gr: require("./strings/gr.js"),

// Tamil
ta: require("./strings/ta.js"),
// Tetum (Timor)
tdt: require("./strings/tdt.js"),
// Ukrainian
uk: require("./strings/uk.js"),

// Russian
ru: require("./strings/ru.js"),

// Romanian & Moldovan
ro: require("./strings/ro.js"),

// Arabic
ar: require("./strings/ar.js"),
// Chinese
// zh-Hans is Simplified Chinese. (CN, SG and MY can use the same file.)
zh_Hans: require("./strings/zh_Hans.js"),
// Chinese (Taiwan)
// zh-Hant is Traditional Chinese (TW, MO and HK can use the same file.)
zh_Hant: require("./strings/zh_Hant.js"),
};


Expand All @@ -85,75 +76,63 @@ preloadHelper.acceptLanguagePromise.then(function() {
prioritized.reverse();


prioritized.forEach(function(languageCode) {
prioritized.forEach(function (languageCode) {
if (languageCode.match(/^en/)) {
_.extend(strings, translations.en_us);
}
else if (languageCode.match(/^ja/)) {
} else if (languageCode.match(/^ja/)) {
_.extend(strings, translations.ja);
}
else if (
} else if (
languageCode.match(/^zh-CN/) ||
languageCode.match(/^zh-SG/) ||
languageCode.match(/^zh-MY/)) {
languageCode.match(/^zh-MY/)
) {
_.extend(strings, translations.zh_Hans);
}
else if (languageCode.match(/^zh/)) { // TW, MO and HK
} else if (languageCode.match(/^zh/)) {
_.extend(strings, translations.zh_Hant);
}
else if (languageCode.match(/^it/)) {
} else if (languageCode.match(/^it/)) {
_.extend(strings, translations.it);
}
else if (languageCode.match(/^da/)) {
} else if (languageCode.match(/^da/)) {
_.extend(strings, translations.da);
}
else if (languageCode.match(/^de/)) {
} else if (languageCode.match(/^de/)) {
_.extend(strings, translations.de);
}
else if (languageCode.match(/^es/)) {
} else if (languageCode.match(/^es/)) {
_.extend(strings, translations.es);
}
else if (languageCode.match(/^fa/)) {
} else if (languageCode.match(/^fa/)) {
_.extend(strings, translations.fa);
}
else if (languageCode.match(/^fr/)) {
} else if (languageCode.match(/^fr/)) {
_.extend(strings, translations.fr);
}
else if (languageCode.match(/^nl/)) {
} else if (languageCode.match(/^nl/)) {
_.extend(strings, translations.nl);
}
else if (languageCode.match(/^sk/)) {
} else if (languageCode.match(/^sk/)) {
_.extend(strings, translations.sk);
}
else if (
languageCode.match(/^pt/) || // To help other Portuguese speaker participants until its specific translation is not here
languageCode.match(/^pt-PT/) || // To help Portuguese participantes until an specific translation is not here
languageCode.match(/^pt-BR/)) {
} else if (
languageCode.match(/^pt/) || // To help Portuguese participants until a specific translation is here
languageCode.match(/^pt-PT/) || // To help Portuguese participants until a specific translation is here
languageCode.match(/^pt-BR/)
) {
_.extend(strings, translations.pt_br);
}
else if (languageCode.match(/^he/)) {
} else if (languageCode.match(/^he/)) {
_.extend(strings, translations.he);
}
else if (languageCode.match(/^cy/)) {
} else if (languageCode.match(/^cy/)) {
_.extend(strings, translations.cy);
}
else if (languageCode.match(/^gr/)) {
_.extend(strings, translations.gr);
}
else if (languageCode.match(/^uk/)) {
} else if (languageCode.match(/^el/)) {
_.extend(strings, translations.el);
} else if (languageCode.match(/^uk/)) {
_.extend(strings, translations.uk);
}
else if (languageCode.match(/^ru/)) {
} else if (languageCode.match(/^ru/)) {
_.extend(strings, translations.ru);
}
else if (languageCode.match(/^ro/)) {
} else if (languageCode.match(/^ro/)) {
_.extend(strings, translations.ro);
}
else if (languageCode.match(/^hr/)) {
} else if (languageCode.match(/^hr/)) {
_.extend(strings, translations.hr);
}
else if (languageCode.match(/^ar/)) {
} else if (languageCode.match(/^ar/)) {
_.extend(strings, translations.ar);
} else if (languageCode.match(/^fy/)) {
_.extend(strings, translations.fy);
} else if (languageCode.match(/^ta/)) {
_.extend(strings, translations.ta);
} else if (languageCode.match(/^tdt/)) {
_.extend(strings, translations.tdt);
}
});
});
Expand Down
Loading

0 comments on commit 17da67a

Please sign in to comment.