<commit_before>require('./bootstrap.js');

new Vue({
    el: '#app',

    data() {
        return {
            searchPhrase: '',
            baseLanguage: langman.baseLanguage,
            selectedLanguage: langman.baseLanguage,
            languages: langman.languages,
            translations: langman.translations,
            selectedKey: null,
            hasChanges: false
        };
    },

    /**
     * The component has been created by Vue.
     */
    mounted() {
        this.addValuesToBaseLanguage();

        this.confirmBeforeLeavingWithChanges('translations');
    },

    computed: {
        /**
         * List of filtered translation keys.
         */
        filteredTranslations() {
            if (this.searchPhrase) {
                return _.chain(this.currentLanguageTranslations)
                    .pickBy(line => {
                        return line.key.toLowerCase().indexOf(this.searchPhrase.toLowerCase()) > -1 || line.value.toLowerCase().indexOf(this.searchPhrase.toLowerCase()) > -1;
                    })
                    .sortBy('value')
                    .value();
            }

            return _.sortBy(this.currentLanguageTranslations, 'value');
        },


        /**
         * List of translation lines from the current language.
         */
        currentLanguageTranslations() {
            return _.map(this.translations[this.selectedLanguage], (value, key) => {
                return {key: key, value: value ? value : ''};
            });
        },


        /**
         * List of untranslated keys from the current language.
         */
        currentLanguageUntranslatedKeys() {
            return _.filter(this.translations[this.selectedLanguage], value => {
                return !value;
            });
        }
    },


    methods: {
        /**
         * Add a new translation key.
         */
        promptToAddNewKey() {
            var key = prompt("Please enter the new key");

            if (key != null) {
                this.addNewKey(key);
            }
        },


        /**
         * Add a new translation key
         */
        addNewKey(key) {
            if (this.translations[this.baseLanguage][key] !== undefined) {
                return alert('This key already exists.');
            }

            _.forEach(this.languages, lang => {
                if (!this.translations[lang]) {
                    this.translations[lang] = {};
                }

                this.$set(this.translations[lang], key, '');
            });

            this.addValuesToBaseLanguage();
        },


        /**
         * Remove the given key from all languages.
         */<commit_msg>Fixes scan of translations in other languages<commit_after>require('./bootstrap.js');

new Vue({
    el: '#app',

    data() {
        return {
            searchPhrase: '',
            baseLanguage: langman.baseLanguage,
            selectedLanguage: langman.baseLanguage,
            languages: langman.languages,
            translations: langman.translations,
            selectedKey: null,
            hasChanges: false
        };
    },

    /**
     * The component has been created by Vue.
     */
    mounted() {
        this.addValuesToBaseLanguage();

        this.confirmBeforeLeavingWithChanges('translations');
    },

    computed: {
        /**
         * List of filtered translation keys.
         */
        filteredTranslations() {
            if (this.searchPhrase) {
                return _.chain(this.currentLanguageTranslations)
                    .pickBy(line => {
                        return line.key.toLowerCase().indexOf(this.searchPhrase.toLowerCase()) > -1 || line.value.toLowerCase().indexOf(this.searchPhrase.toLowerCase()) > -1;
                    })
                    .sortBy('value')
                    .value();
            }

            return _.sortBy(this.currentLanguageTranslations, 'value');
        },


        /**
         * List of translation lines from the current language.
         */
        currentLanguageTranslations() {
            return _.map(this.translations[this.selectedLanguage], (value, key) => {
                return {key: key, value: value ? value : ''};
            });
        },


        /**
         * List of untranslated keys from the current language.
         */
        currentLanguageUntranslatedKeys() {
            return _.filter(this.translations[this.selectedLanguage], value => {
                return !value;
            });
        }
    },


    methods: {
        /**
         * Add a new translation key.
         */
        promptToAddNewKey() {
            var key = prompt("Please enter the new key");

            if (key != null) {
                this.addNewKey(key);
            }
        },


        /**
         * Add a new translation key
         */
        addNewKey(key) {
            _.forEach(this.languages, lang => {
                if (this.translations[lang][key] !== undefined) {
                    return;
                }

                if (!this.translations[lang]) {
                    this.translations[lang] = {};
                }

                this.$set(this.translations[lang], key, '');
            });

            this.addValuesToBaseLanguage();
        },

        /**
         * Remove the given key from all languages.
         */
{'fraction_non_alphanumeric': 0.11733931240657698, 'fraction_numerical': 0.0007473841554559044, 'mean_word_length': 1.3769982238010656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2723948', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1311, 'n_words': 266}