package com.commercetools.sunrise.common.template.i18n;

import io.sphere.sdk.models.Base;

/**
 * i18n Identifier, consisting of the message key and the bundle.
 *
 * - {@code bundle}: usually represents a module (e.g. catalog)
 * - {@code messageKey}: can contain multiple path elements (e.g. pagination.next)
 *
 * @see I18nIdentifier
 */
public final class I18nIdentifier extends Base {

    private final String bundle;
    private final String messageKey;

    private I18nIdentifier(final String bundle, final String messageKey) {
        this.bundle = bundle;
        this.messageKey = messageKey;
    }

    public String bundle() {
        return bundle;
    }

    public String messageKey() {
        return messageKey;
    }

    public static I18nIdentifier of(final String bundle, final String key) {
        return new I18nIdentifier(bundle, key);
    }
}

@@ -85,16 +85,156 @@
 .Base;%0A%0A
+import static com.commercetools.sunrise.common.utils.ArrayUtils.getArrayElement;%0Aimport static org.apache.commons.lang3.StringUtils.split;%0A%0A
 /**%0A * i
@@ -1002,11 +1002,930 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Creates a i18n Identifier, consisting of the message key and the bundle.%0A     * @param bundleWithKey of the form %7B@code bundle:key%7D%0A     * @return the i18n Identifier for the given input%0A     * @deprecated use %7B@link I18nIdentifierFactory%7D instead%0A     */%0A    @Deprecated%0A    public static I18nIdentifier of(final String bundleWithKey) %7B%0A        final String%5B%5D parts = split(bundleWithKey, %22:%22, 2);%0A        final String key = getArrayElement(parts, 1, bundleWithKey);%0A        final String bundle;%0A        if (bundleWithKey.equals(key)) %7B%0A            bundle = %22main%22;%0A        %7D else %7B%0A            bundle = getArrayElement(parts, 0, %22main%22);%0A        %7D%0A        return ofBundleAndKey(bundle, key);%0A    %7D%0A%0A    /**%0A     * @deprecated use %7B@link #of%7D instead%0A     */%0A    @Deprecated%0A    public static I18nIdentifier ofBundleAndKey(final String bundle, final String key) %7B%0A        return of(bundle, key);%0A    %7D
 %0A%7D%0A

Add deprecated messages to i18n identifier methods