Commit 9a33b65f authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Merge branch 'renovate/i18next-15.x' into 'master'

Update dependency i18next to v15

See merge request !252
parents 8e0e51da 6d2fc07e
......@@ -10,4 +10,5 @@ NativeModules.RNShare = {
jest.mock('react-native-device-info', () => ({
hasNotch: () => false,
getDeviceLocale: () => 'en',
}));
......@@ -5,12 +5,17 @@ I18n {
"addResource": [Function],
"addResourceBundle": [Function],
"addResources": [Function],
"default": [Circular],
"format": undefined,
"getDataByLanguage": [Function],
"getResource": [Function],
"getResourceBundle": [Function],
"hasResourceBundle": [Function],
"isInitialized": true,
"language": "en",
"languages": Array [
"en",
],
"logger": Logger {
"debug": false,
"logger": Object {
......@@ -5681,6 +5686,7 @@ I18n {
"unescapeSuffix": "",
"useRawValueToEscape": false,
},
"language": "en",
"languageUtils": LanguageUtil {
"logger": Logger {
"debug": false,
......
import * as reactNativeLocaleDetector from 'react-native-locale-detector';
import {
apiRequest,
apiUrl,
......@@ -9,6 +7,8 @@ import {
TokenInvalidError,
} from '../../app/utils/url';
import DeviceInfo from 'react-native-device-info';
const fetchPromiseResult = {
status: 200,
json: () => Promise.resolve('responseJson'),
......@@ -19,11 +19,6 @@ global.fetch = jest.fn().mockReturnValue(
);
fetchPromiseResult.clone = global.fetch;
jest.mock('react-native-locale-detector', () => ({
__esModule: true,
default: 'nl',
}));
describe('url helper', () => {
beforeEach(() => {
});
......@@ -41,7 +36,7 @@ describe('url helper', () => {
return apiRequest('route', {}, null)
.then((response) => {
expect(global.fetch).toBeCalledWith(`${apiUrl}/route/`,
{ headers: { 'Accept-Language': 'nl' } });
{ headers: { 'Accept-Language': 'en' } });
expect(response).toEqual('responseJson');
});
});
......@@ -52,7 +47,7 @@ describe('url helper', () => {
params: 'value',
}).then(() => {
expect(global.fetch).toBeCalledWith(`${apiUrl}/route/?params=value`,
{ headers: { 'Accept-Language': 'nl' } });
{ headers: { 'Accept-Language': 'en' } });
});
});
......@@ -60,7 +55,7 @@ describe('url helper', () => {
expect.assertions(1);
return apiRequest('route', { headers: { Authorization: 'Token abc' } }, null).then(() => {
expect(global.fetch).toBeCalledWith(`${apiUrl}/route/`,
{ headers: { 'Accept-Language': 'nl', Authorization: 'Token abc' } });
{ headers: { 'Accept-Language': 'en', Authorization: 'Token abc' } });
});
});
......@@ -69,7 +64,7 @@ describe('url helper', () => {
return apiRequest('route', {}, null)
.then((response) => {
expect(global.fetch).toBeCalledWith(`${apiUrl}/route/`,
{ headers: { 'Accept-Language': 'nl' } });
{ headers: { 'Accept-Language': 'en' } });
expect(response).toEqual('responseJson');
});
});
......@@ -138,7 +133,7 @@ describe('url helper', () => {
});
it('should default to an English locales', () => {
reactNativeLocaleDetector.default = 'fr';
DeviceInfo.getDeviceLocale = () => 'fr';
expect.assertions(1);
return apiRequest('route', {}, null)
.then(() => {
......
......@@ -80,7 +80,6 @@ dependencies {
implementation project(':react-native-screens')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-sentry')
implementation project(':react-native-locale-detector')
implementation project(':react-native-vector-icons')
implementation project(':react-native-snackbar')
implementation project(':react-native-linear-gradient')
......
......@@ -11,8 +11,6 @@ include ':react-native-sentry'
project(':react-native-sentry').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sentry/android')
include ':react-native-snackbar'
project(':react-native-snackbar').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-snackbar/android')
include ':react-native-locale-detector'
project(':react-native-locale-detector').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-locale-detector/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-linear-gradient'
......
......@@ -7,7 +7,7 @@ import { Provider } from 'react-redux';
import { I18nextProvider, withTranslation } from 'react-i18next';
import createSagaMiddleware from 'redux-saga';
import firebase from 'react-native-firebase';
import locale from 'react-native-locale-detector';
import DeviceInfo from 'react-native-device-info';
import Moment from 'moment';
import 'moment/locale/nl';
import PropTypes from 'prop-types';
......@@ -35,7 +35,7 @@ sagaMiddleware.run(sagas);
class Main extends Component {
constructor() {
super();
if (locale.startsWith('nl')) {
if (DeviceInfo.getDeviceLocale().startsWith('nl')) {
Moment.locale('nl');
} else {
Moment.locale('en');
......
......@@ -5,7 +5,7 @@ import {
} from 'react-native';
import { withTranslation } from 'react-i18next';
import Moment from 'moment';
import locale from 'react-native-locale-detector';
import DeviceInfo from 'react-native-device-info';
import CalendarItem from './CalendarItemConnector';
import LoadingScreen from '../../components/loadingScreen/LoadingScreen';
import ErrorScreen from '../../components/errorScreen/ErrorScreen';
......@@ -30,7 +30,7 @@ const addEventToSection = (sections, date, event) => {
if (!(day in sections[sectionKey].data)) {
sections[sectionKey].data[day] = {
dayNumber: day,
dayOfWeek: locale.startsWith('nl') ? date.format('dd') : date.format('ddd'),
dayOfWeek: DeviceInfo.getDeviceLocale().startsWith('nl') ? date.format('dd') : date.format('ddd'),
events: [],
};
}
......
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import i18nextReactNative from 'i18next-react-native-language-detector';
import DeviceInfo from 'react-native-device-info';
import locales from '../assets/locales/index';
i18n
.use(initReactI18next)
.use(i18nextReactNative)
.use({
init: Function.prototype,
type: 'languageDetector',
detect: DeviceInfo.getDeviceLocale,
cacheUserLanguage: Function.prototype,
})
.init({
nsSeparator: false,
keySeparator: false,
......
import locale from 'react-native-locale-detector';
import DeviceInfo from 'react-native-device-info';
let server = 'https://thalia.nu';
/* istanbul ignore next line */
......@@ -49,6 +49,7 @@ export const apiRequest = (route, fetchOpts, params) => {
requestOptions.headers = {};
}
const locale = DeviceInfo.getDeviceLocale();
if (locale.includes('en') || locale.includes('nl')) {
requestOptions.headers['Accept-Language'] = locale;
} else {
......
......@@ -5,6 +5,7 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
......@@ -61,7 +62,6 @@
BE352A2FF03A4DFCBC212D20 /* FontAwesome5_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 380716DB628F4CBF8859F06F /* FontAwesome5_Regular.ttf */; };
C8DC36F2E75C421391FE7443 /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2B659ACB63B94E3FA4D28634 /* Foundation.ttf */; };
C93A939392B042B9A91C58F0 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 620B1E415CFE41A486D41EF8 /* Entypo.ttf */; };
CFDFC2E80A664438AFB0DEC6 /* libRNI18n.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CCBEE8FD4C1D42BEBE4D8BC8 /* libRNI18n.a */; };
D13DD0FB97FFF6E508D016A7 /* libPods-ThaliApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E879B26C462C7F97AAE66B84 /* libPods-ThaliApp.a */; };
D1655AD483AA43B5B9824968 /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BD085901ADC14158AF3FDED5 /* AntDesign.ttf */; };
D69A89316A03410282D32507 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 05FB677721F74722AE7ADF2E /* Octicons.ttf */; };
......@@ -253,20 +253,6 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNFirebase;
};
327DC49D229EB42A00DE29E9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 22C296C90CCF4315A310E20B /* RNI18n.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = CDD7BF781B2D5125006FDA75;
remoteInfo = RNI18n;
};
327DC49F229EB42A00DE29E9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 22C296C90CCF4315A310E20B /* RNI18n.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = CDD7BF831B2D5126006FDA75;
remoteInfo = RNI18nTests;
};
327DC4E0229EB5A700DE29E9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 327DC4B2229EB5A700DE29E9 /* RNSentry.xcodeproj */;
......@@ -484,7 +470,6 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ThaliApp/main.m; sourceTree = "<group>"; };
13BDFD6446B9442B9FDACCF9 /* RNFirebase.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFirebase.xcodeproj; path = "../node_modules/react-native-firebase/ios/RNFirebase.xcodeproj"; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
22C296C90CCF4315A310E20B /* RNI18n.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNI18n.xcodeproj; path = "../node_modules/react-native-locale-detector/RNI18n.xcodeproj"; sourceTree = "<group>"; };
2B659ACB63B94E3FA4D28634 /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* ThaliApp-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ThaliApp-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* ThaliApp-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ThaliApp-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -564,7 +549,6 @@
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
D13DD0FB97FFF6E508D016A7 /* libPods-ThaliApp.a in Frameworks */,
FABAFD09693B40C6BB12473C /* libRNFirebase.a in Frameworks */,
CFDFC2E80A664438AFB0DEC6 /* libRNI18n.a in Frameworks */,
551DB1D439844F9A9B05A645 /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -777,15 +761,6 @@
name = Products;
sourceTree = "<group>";
};
327DC499229EB42A00DE29E9 /* Products */ = {
isa = PBXGroup;
children = (
327DC49E229EB42A00DE29E9 /* libRNI18n.a */,
327DC4A0229EB42A00DE29E9 /* RNI18nTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
327DC4B3229EB5A700DE29E9 /* Products */ = {
isa = PBXGroup;
children = (
......@@ -898,7 +873,6 @@
327DC528229EB6B500DE29E9 /* RNVectorIcons.xcodeproj */,
327DC531229EB6C300DE29E9 /* BVLinearGradient.xcodeproj */,
327DC53A229EB6D000DE29E9 /* RNSnackbar.xcodeproj */,
22C296C90CCF4315A310E20B /* RNI18n.xcodeproj */,
13BDFD6446B9442B9FDACCF9 /* RNFirebase.xcodeproj */,
);
name = Libraries;
......@@ -1132,10 +1106,6 @@
ProductGroup = 327DC543229EB76A00DE29E9 /* Products */;
ProjectRef = 327DC542229EB76A00DE29E9 /* RNGestureHandler.xcodeproj */;
},
{
ProductGroup = 327DC499229EB42A00DE29E9 /* Products */;
ProjectRef = 22C296C90CCF4315A310E20B /* RNI18n.xcodeproj */;
},
{
ProductGroup = 327DC523229EB68D00DE29E9 /* Products */;
ProjectRef = 327DC522229EB68D00DE29E9 /* RNScreens.xcodeproj */;
......@@ -1336,20 +1306,6 @@
remoteRef = 327DC497229EB42900DE29E9 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
327DC49E229EB42A00DE29E9 /* libRNI18n.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNI18n.a;
remoteRef = 327DC49D229EB42A00DE29E9 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
327DC4A0229EB42A00DE29E9 /* RNI18nTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = RNI18nTests.xctest;
remoteRef = 327DC49F229EB42A00DE29E9 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
327DC4E1229EB5A700DE29E9 /* libRNSentry.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
......
......@@ -4086,11 +4086,6 @@ https-proxy-agent@^2.2.1:
agent-base "^4.1.0"
debug "^3.1.0"
i18next-react-native-language-detector@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/i18next-react-native-language-detector/-/i18next-react-native-language-detector-1.0.2.tgz#5c47482611a44262302a363d5be34a42b11ddfc6"
integrity sha1-XEdIJhGkQmIwKjY9W+NKQrEd38Y=
i18next-scanner@2.10.2:
version "2.10.2"
resolved "https://registry.yarnpkg.com/i18next-scanner/-/i18next-scanner-2.10.2.tgz#3552aceee56584775a78fecb0f4ba7189b1ecf32"
......@@ -4124,10 +4119,12 @@ i18next@*:
dependencies:
"@babel/runtime" "^7.3.1"
i18next@14.1.1:
version "14.1.1"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-14.1.1.tgz#d569aff68c088151f09fcb0cb6f44b36d62731d3"
integrity sha512-HItn9RHLyrDqe6pw6qXMYHGPHNc3y1FZndJfBlD6k4sRS0FAlYLvqCDVIWFc1XultBgsv348TtvL/lleG6JgBg==
i18next@15.1.3:
version "15.1.3"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-15.1.3.tgz#f1984cbee0e3cb00cff9008b037264289ce8840a"
integrity sha512-hN2DZLoRSY2h/RYeNqth5XxV4N1ekKGSJDCGhFmmuXkOCAfK5CkUG4VBv9OBXrvf93xApv0KKBVrb0zJP31EKg==
dependencies:
"@babel/runtime" "^7.3.1"
iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13:
version "0.4.24"
......@@ -7028,11 +7025,6 @@ react-native-linear-gradient@2.5.4:
resolved "https://registry.yarnpkg.com/react-native-linear-gradient/-/react-native-linear-gradient-2.5.4.tgz#dce133526f5a5510a639af94544f1ed0c984bd1e"
integrity sha512-FF1NhlerA4uBiS0gFIHa4FBp8/aftv4vPj14Y47lGNkYjSI94tnI6oYO3EfUxXjEyCUPiOVNKZOB9kScyjc5Ew==
react-native-locale-detector@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/react-native-locale-detector/-/react-native-locale-detector-1.0.1.tgz#c002261ecb60619e5952257c8c7fa31c2c15ed30"
integrity sha1-wAImHstgYZ5ZUiV8jH+jHCwV7TA=
react-native-render-html@4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/react-native-render-html/-/react-native-render-html-4.1.2.tgz#dfd06ac7e87ed68b6421750e88dd7895d284935b"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment