@@ -0,0 +1,2764 @@
+package com.github.letsdrink.intellijplugin.translation;%0A%0A%0Aimport com.intellij.patterns.PlatformPatterns;%0Aimport com.intellij.psi.PsiElement;%0Aimport com.intellij.psi.tree.IElementType;%0Aimport com.intellij.psi.util.PsiTreeUtil;%0Aimport com.jetbrains.php.lang.parser.PhpElementTypes;%0Aimport com.jetbrains.php.lang.psi.elements.ArrayHashElement;%0A%0Aimport java.util.Collection;%0Aimport java.util.LinkedList;%0A%0Aimport static com.github.letsdrink.intellijplugin.PsiUtils.getContent;%0A%0Apublic class TranslationHashElement %7B%0A    private final ArrayHashElement hashElement;%0A%0A    public TranslationHashElement(ArrayHashElement hashElement) %7B%0A        this.hashElement = hashElement;%0A    %7D%0A%0A    public static TranslationHashElement newInstance(PsiElement element) %7B%0A        ArrayHashElement hashElement;%0A        if (element instanceof ArrayHashElement) %7B%0A            hashElement = (ArrayHashElement) element;%0A        %7D else %7B%0A            hashElement = PsiTreeUtil.getParentOfType(element, ArrayHashElement.class);%0A        %7D%0A        return new TranslationHashElement(hashElement);%0A    %7D%0A%0A    public Collection%3CString%3E getChildrenFullKeys() %7B%0A        LinkedList%3CString%3E children = new LinkedList%3CString%3E();%0A        getChildrenFullKeys(%22%22, hashElement, children);%0A        return children;%0A    %7D%0A%0A    private void getChildrenFullKeys(String parentKey, ArrayHashElement element, Collection%3CString%3E children) %7B%0A        if (!parentKey.isEmpty()) %7B%0A            parentKey = parentKey + %22.%22;%0A        %7D%0A        String fullKey = parentKey + getKey(element);%0A%0A        if (is(element.getValue(), PhpElementTypes.ARRAY_CREATION_EXPRESSION)) %7B%0A            for (PsiElement psiElement : element.getValue().getChildren()) %7B%0A                getChildrenFullKeys(fullKey, (ArrayHashElement) psiElement, children);%0A            %7D%0A        %7D else if (!parentKey.isEmpty()) %7B%0A            children.add(fullKey);%0A        %7D%0A    %7D%0A%0A    public String getFullKey() %7B%0A        StringBuilder sb = new StringBuilder();%0A        getFullKey(hashElement, sb);%0A        return sb.toString();%0A    %7D%0A%0A    private void getFullKey(ArrayHashElement element, StringBuilder sb) %7B%0A        if (is(element.getParent(), PhpElementTypes.ARRAY_CREATION_EXPRESSION) && is(element.getParent().getParent().getParent(), PhpElementTypes.HASH_ARRAY_ELEMENT)) %7B%0A            getFullKey((ArrayHashElement) element.getParent().getParent().getParent(), sb);%0A            if (sb.length() %3E 0) %7B%0A                sb.append('.');%0A            %7D%0A            sb.append(getKey(element));%0A        %7D%0A    %7D%0A%0A    private String getKey(ArrayHashElement element) %7B%0A        return getContent(element.getKey());%0A    %7D%0A%0A    private static boolean is(PsiElement element, IElementType type) %7B%0A        return PlatformPatterns.psiElement(type).accepts(element);%0A    %7D%0A%7D%0A

work in progress