Package ariba.ui.aribaweb.util

Examples of ariba.ui.aribaweb.util.AWSingleLocaleResourceManager$PseudoLocalizer


    }

    private AWElement localizedElement (AWComponent component)
    {
        boolean UseStaticCache = !AWConcreteApplication.IsRapidTurnaroundEnabled;
        AWSingleLocaleResourceManager resourceManager = (AWSingleLocaleResourceManager)component.resourceManager();
        AWElement localizedElement = (AWElement)_localizedElements.get(resourceManager);
        if (localizedElement == null) {
            synchronized (this) {
                localizedElement = (AWElement)_localizedElements.get(resourceManager);
                if (localizedElement == null) {

                    Map elementCache = null;
                    String stringTableEntry = null;
                    Map localizedStringsHashtable = loadLocalizedAWLStrings(component);
                    if (localizedStringsHashtable != null && _key != null) {
                        if (!UseStaticCache) {
                            elementCache = (Map)localizedStringsHashtable.get("___cache___");
                            if (elementCache != null) {
                                // check if we've inherited some other locales map
                                if (elementCache.get("__RM__") != resourceManager) {
                                    elementCache = null;
                                } else {
                                    localizedElement = (AWElement)elementCache.get(_key);
                                }
                            }

                            if (elementCache == null) {
                                // we put a cache map in the ResourceService strings Map (hack!)
                                // Unfortunately, when en_US is copied to another locale we can inherit that
                                // cache, so we tag the cache and check for it (above)
                                elementCache = MapUtil.map();
                                localizedStringsHashtable.put("___cache___", elementCache);
                                elementCache.put("__RM__", resourceManager);
                            }
                        }
                        if (localizedElement == null) {
                            stringTableEntry = (String)localizedStringsHashtable.get(_key);
                        }
                    } else {
                        // Pseudo localizing?
                        if (resourceManager.pseudoLocalizingAll() && contentElement() != null) {
                            stringTableEntry = localizedStringForElement(contentElement());
                            stringTableEntry = resourceManager.pseudoLocalizeUnKeyed(stringTableEntry);
                        } else {
                            // No key, just use the template content as is
                            localizedElement = contentElement();
                        }
                    }
View Full Code Here


    public Object value (Object object)
    {
        // Localized bindings only work in for AWComponents
        AWComponent component = (AWComponent)object;
        AWSingleLocaleResourceManager resourceManager =
            (AWSingleLocaleResourceManager)component.resourceManager();
        AWEncodedString localizedString = (AWEncodedString)_localizedStringsHashtable.get(resourceManager);
        if (localizedString == null) {
            synchronized (this) {
                localizedString = (AWEncodedString)_localizedStringsHashtable.get(resourceManager);
                if (localizedString == null) {
                    Map localizedStringsHashtable = AWLocal.loadLocalizedAWLStrings(component);
                    if (localizedStringsHashtable != null) {
                        String stringForKey = (String)localizedStringsHashtable.get(_key);
                        if (stringForKey != null) {
                            localizedString = AWEncodedString.sharedEncodedString(stringForKey);
                        }
                    }
                    if (localizedString == null) {
                        String string = resourceManager.pseudoLocalizeUnKeyed(_defaultString);
                        if (AWLocal.IsDebuggingEnabled) {
                            localizedString = AWEncodedString.sharedEncodedString(addEmbeddedContextToString(_key, string, component));
                        }
                        else {
                            localizedString = AWEncodedString.sharedEncodedString(string);
View Full Code Here

    ///////////////
    //
    ///////////////
    public AWSingleLocaleResourceManager createResourceManager (AWMultiLocaleResourceManager multiLocaleResourceManager, Locale locale)
    {
        AWSingleLocaleResourceManager singleLocaleResourceManager
                = new AWSingleLocaleResourceManager(multiLocaleResourceManager, locale);
        singleLocaleResourceManager.init();
        return singleLocaleResourceManager;
    }
View Full Code Here

        return manager.registeredPackageNames();
    }

    public AWMultiLocaleResourceManager multiLocaleResourceManager()
    {
        AWSingleLocaleResourceManager resourceManager = (AWSingleLocaleResourceManager)resourceManager();
        AWMultiLocaleResourceManager multiLocaleResourceManager = resourceManager.multiLocaleResourceManager();
        return multiLocaleResourceManager;
    }
View Full Code Here

        }


        public String cacheLookup (Context context, String key)
        {
            AWSingleLocaleResourceManager resourceManager = (AWSingleLocaleResourceManager)resourceManager(context);
            return (String)_localizedStringsHashtable.get(resourceManager);
        }
View Full Code Here

            return (String)_localizedStringsHashtable.get(resourceManager);
        }

        public String fullLookup (Context context, String key, String stringTable, String fileKey, String defaultString)
        {
            AWSingleLocaleResourceManager resourceManager = (AWSingleLocaleResourceManager)resourceManager(context);
            synchronized (this) {
                String localizedString = (String)_localizedStringsHashtable.get(resourceManager);
                if (localizedString == null) {
                    AWStringLocalizer localizer = AWConcreteApplication.SharedInstance.getStringLocalizer();

                    Map localizedStringsHashtable =  localizer.getLocalizedStrings (stringTable, fileKey, resourceManager);
                    if (localizedStringsHashtable != null) {
                        localizedString = (String)localizedStringsHashtable.get(key);
                    }
                    if (localizedString == null) {
                        localizedString = resourceManager.pseudoLocalizeUnKeyed(defaultString);
                    }
                    if (!AWConcreteApplication.IsRapidTurnaroundEnabled) {
                        _localizedStringsHashtable.put(resourceManager, localizedString);
                    }
                }
View Full Code Here

    }

    protected AWResource javaSourceFileResource (Class cls)
    {
        AWResource resource = null;
        AWSingleLocaleResourceManager resourceManager =
            AWConcreteApplication.SharedInstance.resourceManager(Locale.US);
        String origComponentName = AWUtil.getClassLoader().getComponentNameForClass(cls.getName());
        String origClassName = origComponentName.replace('.','/');
        String sourceFileName = Fmt.S("%s.java",origClassName);

        resource = resourceManager.resourceNamed(sourceFileName);
        if (resource == null) {
            //
        }
        return resource;
    }
View Full Code Here

TOP

Related Classes of ariba.ui.aribaweb.util.AWSingleLocaleResourceManager$PseudoLocalizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.