Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.temp.foundation.client.util;

import org.litesoft.externalization.shared.*;

import com.google.gwt.i18n.client.Dictionary;
import com.temp.common.shared.utils.*;

import java.util.*;

public class ExternalizedText implements E13nSubstitutionData {
    private static ExternalizedText instance;

    private final Dictionary dictionary;
    private final Set<String> keys;

    public static ExternalizedText getInstance() {
        if ( instance == null ) {
            instance = new ExternalizedText( Dictionary.getDictionary( "ExternalTemplateText" ) );
        }
        return instance;
    }

    private ExternalizedText( Dictionary dictionary ) {
        this.dictionary = dictionary;
        this.keys = dictionary.keySet();
    }

    private String safeGet( String key ) {
        return keys.contains( key ) ? dictionary.get( key ) : null;
    }

    /**
     * Get the Template value associated with the key
     *
     * @param pKey Leading and trailing spaces are ignored
     *
     * @return null or the Template value associated with the key
     */
    public String get( String pKey ) {
        pKey = StringUtils.noEmpty( pKey );
        return (pKey != null) ? StringUtils.noEmpty( safeGet( pKey ) ) : null;
    }
}

Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/foundation/client/util/ExternalizedText.java

Diff revisions: vs.
Revision Author Commited Message
965 GeorgeS picture GeorgeS Fri 01 Aug, 2014 03:20:35 +0000

!