Fix imports/exports

This commit is contained in:
David Baker 2017-05-23 18:32:45 +01:00
parent cc0924f1c7
commit f412552c2c
3 changed files with 8 additions and 8 deletions

View file

@ -30,7 +30,7 @@ const AddThreepid = require('../../AddThreepid');
const SdkConfig = require('../../SdkConfig');
import AccessibleButton from '../views/elements/AccessibleButton';
import _t from 'counterpart-riot';
const languageHandler = require('../../languageHandler');
import * as languageHandler from('../../languageHandler');
import * as FormattingUtils from '../../utils/FormattingUtils';
// if this looks like a release, use the 'version' from package.json; else use

View file

@ -19,7 +19,7 @@ import React from 'react';
import sdk from '../../../index';
import UserSettingsStore from '../../../UserSettingsStore';
import _t from 'counterpart-riot';
import languageHandler from '../../../languageHandler';
import * as languageHandler from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig';
let LANGUAGES = [];

View file

@ -18,11 +18,11 @@ import request from 'browser-request';
// Workaround for broken export
import * as counterpart from 'counterpart-riot';
import UserSettingsStore from './UserSettingsStore';
var q = require('q');
import q from 'q';
const i18nFolder = 'i18n/';
module.exports.setLanguage = function(languages, extCounterpart=null) {
export function setLanguage(languages, extCounterpart=null) {
if (!languages || !Array.isArray(languages)) {
const languages = this.getNormalizedLanguageKeys(this.getLanguageFromBrowser());
console.log("no language found. Got from browser: " + JSON.stringify(languages));
@ -112,7 +112,7 @@ module.exports.setLanguage = function(languages, extCounterpart=null) {
});
};
module.exports.getAllLanguageKeysFromJson = function() {
export function getAllLanguageKeysFromJson() {
let deferred = q.defer();
request(
@ -139,11 +139,11 @@ module.exports.getAllLanguageKeysFromJson = function() {
return deferred.promise;
}
module.exports.getLanguageFromBrowser = function() {
export function getLanguageFromBrowser() {
return navigator.languages[0] || navigator.language || navigator.userLanguage;
};
module.exports.getNormalizedLanguageKeys = function(language) {
export function getNormalizedLanguageKeys(language) {
if (!language) {
return;
}
@ -161,6 +161,6 @@ module.exports.getNormalizedLanguageKeys = function(language) {
return languageKeys;
};
module.exports.normalizeLanguageKey = function(language) {
export function normalizeLanguageKey(language) {
return language.toLowerCase().replace("_","-");
};