You've already forked joplin
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:
CliClient
ElectronClient
ReactNativeClient/lib
@ -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) {
|
||||
|
Reference in New Issue
Block a user