1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-21 23:17:42 +02:00

Refactoring so that CLI app and Electron app share the same base application

This commit is contained in:
Laurent Cozic
2017-11-04 12:23:46 +00:00
parent f1e1db6744
commit 6e4effdecf
14 changed files with 517 additions and 524 deletions

@ -3,6 +3,7 @@ const { shim } = require('lib/shim.js');
const { GeolocationNode } = require('lib/geolocation-node.js');
const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
const { time } = require('lib/time-utils.js');
const { setLocale, defaultLocale, closestSupportedLocale } = require('lib/locale.js');
function fetchRequestCanBeRetried(error) {
if (!error) return false;
@ -41,6 +42,17 @@ function shimInit() {
shim.Geolocation = GeolocationNode;
shim.FormData = require('form-data');
shim.detectAndSetLocale = function (Setting) {
let locale = process.env.LANG;
if (!locale) locale = defaultLocale();
locale = locale.split('.');
locale = locale[0];
locale = closestSupportedLocale(locale);
Setting.setValue('locale', locale);
setLocale(locale);
return locale;
}
const nodeFetch = require('node-fetch');
shim.fetch = async function(url, options = null) {