Package net.sf.saxon.number

Examples of net.sf.saxon.number.Numberer


    private void setLocalizers(Configuration config) {
        config.setLocalizerFactory(new LocalizerFactory() {

            public Numberer getNumberer(String language, String country) {
                Numberer n;
                if (language == null) {
                    n = new Numberer_en();
                } else if (language.equals("da")){
                    n = new net.sf.saxon.option.local.Numberer_da();
                } else if (language.equals("de")){
                    n = new net.sf.saxon.option.local.Numberer_de();
                } else if (language.equals("fr")){
                    n = new net.sf.saxon.option.local.Numberer_fr();
                } else if (language.equals("fr-BE")){
                    n = new net.sf.saxon.option.local.Numberer_frBE();
                } else if (language.equals("it")){
                    n = new net.sf.saxon.option.local.Numberer_it();
                } else if (language.equals("nl")){
                    n = new net.sf.saxon.option.local.Numberer_nl();
                } else if (language.equals("nl-BE")){
                    n = new net.sf.saxon.option.local.Numberer_nlBE();
                } else if (language.equals("sv")){
                    n = new net.sf.saxon.option.local.Numberer_sv();
                } else {
                    n = new Numberer_en();
                }
                if (country != null) {
                    n.setCountry(country);
                }
                return n;
            }
        });
View Full Code Here


    public Numberer makeNumberer(String language, String country) {
        if (localizerFactory == null) {
            return new Numberer_en();
        } else {
            Numberer numberer = localizerFactory.getNumberer(language, country);
            if (numberer == null) {
                numberer = new Numberer_en();
            }
            return numberer;
        }
View Full Code Here

     */

    private static CharSequence formatDate(CalendarValue value, String format, String language, String country, XPathContext context)
    throws XPathException {

        Numberer numberer = context.getConfiguration().makeNumberer(language, country);
        FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.SMALL);
        if (numberer instanceof Numberer_en && !"en".equals(language)) {
            sb.append("[Language: en]");
        }
        int i = 0;
View Full Code Here

    /**
    * Load a Numberer class for a given language and check it is OK.
    */

    protected static Numberer makeNumberer (String language) {
        Numberer numberer;
        if (language.equals("en")) {
            numberer = defaultNumberer;
        } else {
            String langClassName = "net.sf.saxon.number.Numberer_";
            for (int i=0; i<language.length(); i++) {
View Full Code Here

        }

        // Use the numberer decided at compile time if possible; otherwise try to get it from
        // a table of numberers indexed by language; if not there, load the relevant class and
        // add it to the table.
        Numberer numb = numberer;
        if (numb == null) {
            String language = lang.evaluateAsString(context);
            if (nationalNumberers == null) {
                nationalNumberers = new HashMap(4);
            }
View Full Code Here

     * @return a suitable numberer. If no specific numberer is available
     * for the language, the default (English) numberer is used.
     */

    public static Numberer makeNumberer(String language) {
        Numberer numberer;
        if ("en".equals(language)) {
            numberer = defaultNumberer;
        } else {
            String langClassName = "net.sf.saxon.number.Numberer_";
            for (int i = 0; i < language.length(); i++) {
View Full Code Here

     */

    private static String formatDate(CalendarValue value, String format, String language, XPathContext context)
    throws XPathException {

        Numberer numberer = NumberInstruction.makeNumberer(language);
        StringBuffer sb = new StringBuffer(32);
        int i = 0;
        while (true) {
            while (i < format.length() && format.charAt(i) != '[') {
                sb.append(format.charAt(i));
View Full Code Here

        }

        // Use the numberer decided at compile time if possible; otherwise try to get it from
        // a table of numberers indexed by language; if not there, load the relevant class and
        // add it to the table.
        Numberer numb = numberer;
        if (numb == null) {
            String language = lang.evaluateAsString(context).toString();
            numb = context.getConfiguration().makeNumberer(language, null);
        }
View Full Code Here

    /**
    * Load a Numberer class for a given language and check it is OK.
    */

    protected Numberer makeNumberer (String language) {
        Numberer numberer;
        if (language.equals("en")) {
            numberer = defaultNumberer;
        } else {
            String langClassName = "net.sf.saxon.number.Numberer_";
            for (int i=0; i<language.length(); i++) {
View Full Code Here

     * @return the default language
     */
    private static String getDefaultLanguage(XPathContext context) {
        String language = Locale.getDefault().getLanguage();
        if (!language.equals("en")) {
            Numberer numberer = NumberInstruction.makeNumberer(language, "us", context);
            if (!numberer.getClass().getName().endsWith("Numberer_" + language)) {
                language = "en";
            }
        }
        return language;
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.number.Numberer

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.