package com.commit451.gitlab;

import android.app.Application;

import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import com.squareup.otto.Bus;

import net.danlew.android.joda.JodaTimeAndroid;

import io.fabric.sdk.android.Fabric;
import timber.log.Timber;

/**
 * App for one time init things
 * Created by Jawn on 7/27/2015.
 */
public class GitLabApp extends Application {

    private static Bus sBus;
    public static Bus bus() {
        if (sBus == null) {
            sBus = new Bus();
        }
        return sBus;
    }

    private static GitLabApp sInstance;
    public static GitLabApp instance() {
        return sInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        sInstance = this;

        CrashlyticsCore core = new CrashlyticsCore.Builder()
                .disabled(BuildConfig.DEBUG)
                .build();
        Fabric.with(this, new Crashlytics.Builder().core(core).build());

        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }

        JodaTimeAndroid.init(this);
    }
}

@@ -55,16 +55,96 @@
 ication;
+%0Aimport android.content.res.Configuration;%0Aimport android.content.res.Resources;
 %0A%0Aimport
@@ -314,16 +314,42 @@
 droid;%0A%0A
+import java.util.Locale;%0A%0A
 import i
@@ -888,16 +888,54 @@
  this;%0A%0A
+        forceLocale(Locale.ENGLISH);%0A%0A
         
@@ -1222,24 +1222,24 @@
 %0A        %7D%0A%0A
-
         Joda
@@ -1267,11 +1267,611 @@
 );%0A    %7D
+%0A%0A    private void forceLocale(Locale locale)%7B%0A        try %7B%0A            Locale.setDefault(locale);%0A%0A            Resources%5B%5D resources = new Resources%5B%5D%7B%0A                    Resources.getSystem(),%0A                    getBaseContext().getResources()%0A            %7D;%0A            for (Resources res : resources) %7B%0A                Configuration configuration = res.getConfiguration();%0A                configuration.locale = locale;%0A                res.updateConfiguration(configuration, res.getDisplayMetrics());%0A            %7D%0A        %7D catch (Exception e) %7B%0A            Timber.e(e, null);%0A        %7D%0A    %7D
 %0A%7D%0A

Force the locale to english