<commit_before>﻿/**
* @ngdoc service
* @name umbraco.services.variantHelper
* @description A helper service for dealing with variants
**/
function variantHelper() {
    /**
     * Returns the id for this variant
     * @param {any} variant
     */
    function getId(variant) {
        var hasLanguage = variant.language && !!variant.language.culture;
        var hasSegment = !!variant.segment;

        var sep = ";";

        if (!hasLanguage && !hasSegment) {
            // Invariant
            return "";
        } else if (hasLanguage && !hasSegment) {
            // Culture only
            return variant.language.culture;
        } else if (!hasLanguage && hasSegment) {
            // Segment only
            return sep + variant.segment;
        } else {
            // Culture and Segment
            return variant.language.culture + sep + variant.segment;
        }
    }

    function getDisplayName(variant) {
        if (variant == null) {
            return "";
        }

        var parts = [];

        if (variant.language && variant.language.name) {
            parts.push(variant.language.name);
        }

        if (variant.segment) {
            parts.push(variant.segment);
        }

        if (parts.length === 0) {
            // Invariant
            parts.push("Default");
        }

        return parts.join(" - ");
    }

    return {
        getId,
        getDisplayName
    }
}
angular.module('umbraco.services').factory('variantHelper', variantHelper);<commit_msg>Segment display name nu capitalized versie van alias<commit_after>﻿/**
* @ngdoc service
* @name umbraco.services.variantHelper
* @description A helper service for dealing with variants
**/
function variantHelper() {
    /**
     * Returns the id for this variant
     * @param {any} variant
     */
    function getId(variant) {
        var hasLanguage = variant.language && !!variant.language.culture;
        var hasSegment = !!variant.segment;

        var sep = ";";

        if (!hasLanguage && !hasSegment) {
            // Invariant
            return "";
        } else if (hasLanguage && !hasSegment) {
            // Culture only
            return variant.language.culture;
        } else if (!hasLanguage && hasSegment) {
            // Segment only
            return sep + variant.segment;
        } else {
            // Culture and Segment
            return variant.language.culture + sep + variant.segment;
        }
    }

    function getDisplayName(variant) {
        if (variant == null) {
            return "";
        }

        var parts = [];

        if (variant.language && variant.language.name) {
            parts.push(variant.language.name);
        }

        if (variant.segment) {
            var capitalized = variant.segment.split(" ").map(p => p[0].toUpperCase() + p.substring(1)).join(" ");
            parts.push(capitalized);
        }

        if (parts.length === 0) {
            // Invariant
            parts.push("Default");
        }

        return parts.join(" - ");
    }

    return {
        getId,
        getDisplayName
    }
}
angular.module('umbraco.services').factory('variantHelper', variantHelper);
{'fraction_non_alphanumeric': 0.12369832754812243, 'fraction_numerical': 0.0012622278321236984, 'mean_word_length': 1.7541268462206776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5397263', 'n_tokens_mistral': 846, 'n_tokens_neox': 818, 'n_words': 196}