<commit_before>(function () {
    "use strict";
    angular.module("App").factory("TranslationService", TranslationService);

    TranslationService.$inject = ["$http", "$window", "TRANSLATIONS"];

    function TranslationService($http, $window, TRANSLATIONS) {
        let service = {
            defaultLanguage: TRANSLATIONS.defaultLanguage,
            userLanguage: TRANSLATIONS.defaultLanguage,
            translation: {},
            setTranslation,
            setUserLanguage
        };

        return service;

        function getUserLanguage() {
            const language = $window.navigator.userLanguage || $window.navigator.language;
            return language.substring(0, 2);
        }

        function setUserLanguage($scope) {
            service.userLanguage = getUserLanguage();
            setTranslation($scope, service.userLanguage);
            appendi18n($scope, service.userLanguage);
        }

        function appendi18n() {

        }

        function setTranslation($scope, translation) {
            function success(response) {
                $scope.translation = service.translation = response.data;
            }

            function error() {
                setTranslation($scope, service.defaultLanguage);
            }

            const url = TRANSLATIONS.dir + translation.toUpperCase() + ".json";
            $http.get(url).then(success, error);
        }
    }
}());<commit_msg>i18n function<commit_after>(function () {
    "use strict";
    angular.module("App").factory("TranslationService", TranslationService);

    TranslationService.$inject = ["$http", "$window", "TRANSLATIONS"];

    function TranslationService($http, $window, TRANSLATIONS) {
        let service = {
            defaultLanguage: TRANSLATIONS.defaultLanguage,
            userLanguage: TRANSLATIONS.defaultLanguage,
            translation: {},
            setTranslation,
            setUserLanguage
        };

        return service;

        function getUserLanguage() {
            const language = $window.navigator.userLanguage || $window.navigator.language;
            return language.substring(0, 2);
        }

        function setUserLanguage($scope) {
            service.userLanguage = getUserLanguage();
            setTranslation($scope, service.userLanguage);
            appendi18n($scope, service.userLanguage);
        }

        function appendi18n() {
            var scirpt = $window.document.createElement("script");
            $window.document.body.appendChild(script);
        }

        function setTranslation($scope, translation) {
            function success(response) {
                $scope.translation = service.translation = response.data;
            }

            function error() {
                setTranslation($scope, service.defaultLanguage);
            }

            const url = TRANSLATIONS.dir + translation.toUpperCase() + ".json";
            $http.get(url).then(success, error);
        }
    }
}());
{'fraction_non_alphanumeric': 0.11211816045652903, 'fraction_numerical': 0.004699563611950319, 'mean_word_length': 2.1534391534391535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6940115', 'n_tokens_mistral': 747, 'n_tokens_neox': 692, 'n_words': 129}