close

Filter

loading table of contents...

Site Manager Developer Manual / Version 2304

Table Of Contents

4.4 Program Own Language Resolver Factories

A property language resolver factory is used to determine the language of a property which will be used for the spell checker.

Interface to implement

Own property language resolver factories must implement the interface hox.corem.editor.PropertyLanguageResolverFactory with the method getLanguageResolver. In addition, an inner class must be created which implements the interface LanguageResolver (see Example 4.5, “Example of a language resolver”).

Parameters to use

The getLanguageResolver method is called with the following parameters:

Parameter

Type

Description

document

DocumentModel

The document for which the language resolver should be built.

propertyType

PropertyTypeModel

The property of the document for which the language resolver should be built.

Table 4.5. Parameters of the getLanguageResolver method


Return types

The getLanguageResolver method returns a hox.gui.LanguageResolver.

Integrate your PropertyLanguageResolverFactory into the Site Manager using editor.xml

You can integrate your PropertyLanguageResolverFactory into the Site Manager using the PropertyLanguageResolverFactory element.

Example

The following example shows a language Resolver which returns locale_US as the language.

package com.coremedia.customer.example.editor;

import java.util.Locale;

import hox.gui.LanguageResolver;

import hox.log.Log;
import hox.corem.editor.Editor;
import hox.corem.editor.proxy.DocumentModel;
import hox.corem.editor.proxy.PropertyTypeModel;
import hox.corem.editor.PropertyLanguageResolverFactory;

public class EnglishLanguageResolverFactory implements 
PropertyLanguageResolverFactory {
  
	private static class EnglishPropertyLanguageResolver 
	implements LanguageResolver {
    
		public Locale getLanguage() {
			Editor.getLog().write(Log.LEVEL_DEBUG, 
			"EnglishLanguageResolverFactory: "+Locale.US);
		return Locale.US;
		}
    
	} 

	private static LanguageResolver englishPropertyLanguageResolver = 
	new EnglishPropertyLanguageResolver();
  
    
	public LanguageResolver getLanguageResolver(DocumentModel document, 
	PropertyTypeModel propertyType) {
	return englishPropertyLanguageResolver;
	} 
} 

Example 4.5. Example of a language resolver


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.