Permalink
Browse files

Use stonejs

  • Loading branch information...
jdavid committed Aug 1, 2017
1 parent 4a54047 commit ad31b1aa2e3b481a97f44ffd972ef0ef0c9e21a2
View
@@ -41,5 +41,5 @@ rebuildsearch:
gettext:
python gettext.py
msgmerge -U locales/fr.po locales/locale.pot
npm run stonejs -- build locales/*.po locales/
msgmerge -U locales/fr.po locales/messages.pot
npm run stonejs -- build --merge locales/*.po js/messages.json
View
@@ -26,7 +26,7 @@
if __name__ == '__main__':
rexp = re.compile('(.*[^a-zA-Z0-9_]|^)t\("(.*?)"[\)|,]')
pot = open('locales/locale.pot', 'w')
pot = open('locales/messages.pot', 'w')
pot.write(HEADER)
msgs = {}
View
@@ -55,7 +55,7 @@ class Connect extends React.Component {
const url = `/api/auth/${provider.id}/connect?token=${csrfToken}`;
return (
<div key={provider.id} className={"col-xs-10 col-xs-offset-1 provider-"+provider.id}>
<a href={url} className="btn btn-primary btn-block">{t("Log in with @label", {"@label": provider.label})}</a>
<a href={url} className="btn btn-primary btn-block">{t("Log in with {label}", {"label": provider.label})}</a>
</div>
);
});
@@ -124,7 +124,7 @@ class ProfileEdit extends React.Component {
return (
<div key={provider.id} className="row">
<div className="col-xs-6">
{t("%label log in", {"%label": provider.label})}
{t("{label} log in", {"label": provider.label})}
</div>
<div className="col-xs-6">
<a href={url} className="btn btn-default btn-sm profile-edit-button">{t("Connect")}</a>
@@ -182,8 +182,8 @@ class RecordWrapper extends React.Component {
noop(evt);
const title = this.state.title ?
this.state.title :
t("Walkthrough on @domain", {
"@domain": URI(this.state.startingUrl).hostname(),
t("Walkthrough on {domain}", {
"domain": URI(this.state.startingUrl).hostname(),
});
const runner = this.getRunner();
if (runner.getName() === "popup") {
View
@@ -0,0 +1 @@
{"fr":{"plural-forms":"nplurals=2; plural=(n > 1);","messages":{"A walkthrough is playing or recording in a different window or tab. Do not close this window.":["Une visite guidée est en cours d'exectution ou d'enregistrement dans une autre fenêtre ou un autre onglet. Ne fermez pas cette fenetre ou cet onlget"],"Abort walkthrough":["Mettre fin à la visite guidée\t"],"Add new site":["Add new site"],"Advanced settings":["Réglages avancés"],"Are you sure that you want to delete this walkthrough?":["Etes vous certain de vouloir supprimer cette visite guidée?"],"Authentication":["Identification"],"Back":["Revenir"],"Cancel":["Annuler"],"Cancel walkthrough":["Annuler la visite guidée"],"Close":["Fermer"],"Code":["Code"],"Command":["Commande"],"Connect":["Connecter"],"Continue":["Poursuivez"],"Create your Walkthrough GIF":["Create your Walkthrough GIF"],"Delete":["Supprimer"],"Description":["Description"],"Disable":["Désactiver"],"Disable 2-factor authentication":["Désactiver l'identification en 2 étapes"],"E-mail":[""],"Edit":["Modifier"],"Edit walkthrough":["Modifier la visite guidée"],"Email":["e-mail"],"Embed codes":["Embed codes"],"Embed these results":["Embed these results"],"Enable 2-factor authentication":["Activer l'identification en 2 étapes"],"Failed to open the popup automatically.":["Echec de l'ouverture automatique du pop-up"],"Finish & Save":["Finish & Save"],"First argument":["Premier argument"],"Forgot your password?":["Mot de passe oublié ?"],"Generate my code!":["Generer mon code !"],"Generate my embed code!":["Generate my embed code!"],"Generate your personalized embed code to record and play walkthroughs":["Generate your personalized embed code to record and play walkthroughs"],"Get help":["Demande d'assistance"],"Help center":["Centre d'assistance"],"Highlight":["Surligner"],"Invalid url":["Invalid url"],"It looks like you haven't got a Walkthrough yet. Add an embed code first to your site.":["It looks like you haven't got a Walkthrough yet. Add an embed code first to your site."],"Loading ...":["Chargement en cours ..."],"Log in":["S'identifier"],"Log in with {label}":[""],"My Walkthroughs":["My Walkthroughs"],"Name":["Nom"],"New again:":["Renouveller"],"New:":["Nouveau"],"Off":["Inactif"],"Old:":["Vieux"],"On":["Actif"],"Open":["Ouvrir"],"Open walkthrough manually":["Ouverture manuelle de la visite guidée"],"Password":["Mot de passe"],"Password change":["Changement de mot de passe"],"Password confirm":["Confirmation du mot de passe"],"Play":["Lancer"],"Play walkthrough":["Lancer la visite guidée"],"Position":["Position"],"Record":["Enregistrer"],"Record button":["Bouton Enregistrer"],"Record walkthrough":["Enregistrer la visite guidée"],"Record walkthroughs and play them on top of websites":["Record walkthroughs and play them on top of websites"],"Recorded steps":["Etapes enregistrées"],"Recorder embed code":["Recorder embed code"],"Recovery email has been sent.":["Recovery email has been sent."],"Register":["S'inscrire"],"Request a one-time login link":["Request a one-time login link"],"Reset":["Ré-initialisation"],"Reset form":["Ré-initialiser le formulaire"],"Save":["Enregistrer"],"Screening gif":["Screening gif"],"Screening widget":["Screening widget"],"Search":["Recherche"],"Second argument":["Second argument"],"Sign in":[""],"Sign up for free":["Inscription gratuite"],"Starting URL":["URL de démarrage"],"Steps":["Etapes"],"The site might not be compatible with this walkhub":["Ce site peut ne pas être compatible avec cette visite guidée"],"The walkthrough is recorded on an HTTP website. Playing the walkthrough will temporarly reload the page in HTTP.":["La visite guidée s'effectue sur un site non sécurisé (HTTP)"],"This walkthrough is only enabled in popup mode":["Cette visite guidée s'effectue obligatoirement en mode pop-up"],"Title":["Titre"],"To enable WalkHub, you need to place this code so that it will be rendered on every page":["To enable WalkHub, you need to place this code so that it will be rendered on every page"],"Token":["Token"],"Two-factor authentication":["Identification en 2 étapes"],"Untitled walkthrough":["Visite guidée sans titre"],"Update your Walkthrough GIF":["Update your Walkthrough GIF"],"Verification email has been sent.":["Verification email has been sent"],"Verify":["Verifier"],"Walkthrough":["Visite guidée"],"Walkthrough on {domain}":["Walkthroughs on the site"],"Walkthroughs on the site":["Walkthroughs on the site"],"Welcome to WalkHub!":["Bienvenue à Walkhub"],"Your Walkthrough will be recorded in a new browser tab, just close the tab when you are finished.":["Your Walkthrough will be recorded in a new browser tab, just close the tab when you are finished."],"email":["e-mail"],"website url":["UURL du site web"],"{label} log in":[""]}}}
View
28 js/t.js
@@ -14,28 +14,10 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import {escapeHTML} from "util";
import messages from 'messages.json';
function isPlural(num) {
return num > 1;
}
var Stone = require("stonejs");
Stone.addCatalogs(messages);
Stone.setBestMatchingLocale();
function replace(s, p, param_p) {
if (p.indexOf("!") !== 0) {
param_p = escapeHTML(param_p);
}
return s.replace(p, param_p);
}
export function t(str, params) {
return params ? Object.keys(params).reduce((s, p) => {
return replace(s, p, params[p]);
}, str) : str;
};
export function pt(str, str_plural, num, params) {
return isPlural(num) ?
t(str_plural, params) :
t(str, params);
};
export var t = Stone.gettext;
View
@@ -189,6 +189,10 @@ msgstr "Chargement en cours ..."
msgid "Log in"
msgstr "S'identifier"
#: js/components/connect.js:58
msgid "Log in with {label}"
msgstr ""
#: js/components/wrappers/profile.js:170
msgid "My Walkthroughs"
msgstr "My Walkthroughs"
@@ -385,6 +389,11 @@ msgstr "Verifier"
msgid "Walkthrough"
msgstr "Visite guidée"
#: js/components/wrappers/record.js:185
#, fuzzy
msgid "Walkthrough on {domain}"
msgstr "Walkthroughs on the site"
#: js/components/wrappers/search.js:115
msgid "Walkthroughs on the site"
msgstr "Walkthroughs on the site"
@@ -408,3 +417,7 @@ msgstr "e-mail"
#: js/components/embedcodebuilder.js:137
msgid "website url"
msgstr "UURL du site web"
#: js/components/profileedit.js:127
msgid "{label} log in"
msgstr ""
@@ -17,10 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: js/components/profileedit.js:127
msgid "%label log in"
msgstr ""
#: js/walkthrough/runner/popup.js:97
msgid "A walkthrough is playing or recording in a different window or tab. Do not close this window."
msgstr ""
@@ -196,7 +192,7 @@ msgid "Log in"
msgstr ""
#: js/components/connect.js:58
msgid "Log in with @label"
msgid "Log in with {label}"
msgstr ""
#: js/components/wrappers/profile.js:170
@@ -394,7 +390,7 @@ msgid "Walkthrough"
msgstr ""
#: js/components/wrappers/record.js:185
msgid "Walkthrough on @domain"
msgid "Walkthrough on {domain}"
msgstr ""
#: js/components/wrappers/search.js:115
@@ -416,3 +412,7 @@ msgstr ""
#: js/components/embedcodebuilder.js:137
msgid "website url"
msgstr ""
#: js/components/profileedit.js:127
msgid "{label} log in"
msgstr ""
View
@@ -47,6 +47,7 @@
"react-router": "^1.0",
"sass-loader": "^3.1",
"sprintf-js": "^1.0.3",
"stonejs": "^2.3.0",
"style-loader": "^0.13",
"url-loader": "^0.5",
"webpack": "^1.12"
View
@@ -46,7 +46,8 @@ var loaders = [
{ test: /\.scss$/, loader: "style!css!sass?"+sassIncludePaths },
{ test: /\.sass$/, loader: "style!css!sass?indentedSyntax&"+sassIncludePaths },
{ test: /.*\.(gif|png|jpe?g|ico)$/i, loader: "file?name=[name]-[sha512:hash:hex:6].[ext]" },
{ test: /\.md$/, loader: "babel-loader!react-markdown!markdown" }
{ test: /\.md$/, loader: "babel-loader!react-markdown!markdown" },
{ test: /\.json$/, loader: 'json' }
];
if (contentpages) {

0 comments on commit ad31b1a

Please sign in to comment.