当前位置: 首页>>代码示例>>Java>>正文


Java LocalizationUtility.makePseudoFriendlyName方法代码示例

本文整理汇总了Java中net.sourceforge.stripes.localization.LocalizationUtility.makePseudoFriendlyName方法的典型用法代码示例。如果您正苦于以下问题:Java LocalizationUtility.makePseudoFriendlyName方法的具体用法?Java LocalizationUtility.makePseudoFriendlyName怎么用?Java LocalizationUtility.makePseudoFriendlyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sourceforge.stripes.localization.LocalizationUtility的用法示例。


在下文中一共展示了LocalizationUtility.makePseudoFriendlyName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveFieldName

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
/**
 * Takes the form field name supplied and tries first to resolve a String in the locale
 * specific bundle for the field name, and if that fails, will try to make a semi-friendly
 * name by parsing the form field name.  The result is stored in replacementParameters[0]
 * for message template parameter replacement.
 */
protected void resolveFieldName(Locale locale) {
    log.debug("Looking up localized field name with messageKey: ", this.fieldNameKey);

    if (this.fieldNameKey == null) {
        getReplacementParameters()[0] = "FIELD NAME NOT SUPPLIED IN CODE";
    }
    else {
        getReplacementParameters()[0] =
                LocalizationUtility.getLocalizedFieldName(this.fieldNameKey,
                                                          this.actionPath,
                                                          this.beanclass,
                                                          locale);

        if (getReplacementParameters()[0] == null) {
            getReplacementParameters()[0] =
                    LocalizationUtility.makePseudoFriendlyName(this.fieldNameKey);
        }
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:26,代码来源:SimpleError.java

示例2: doEndInputTag

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
/**
 * Performs the main work of the tag as described in the class level javadoc.
 * @return EVAL_PAGE in all cases.
 * @throws JspException if an IOException is encountered writing to the output stream.
 */
@Override
public int doEndInputTag() throws JspException {
    try {
        String label = getLocalizedFieldName();
        String fieldName = getAttributes().remove("name");

        if (label == null) {
            label = getBodyContentAsString();
        }

        if (label == null) {
            if (fieldName != null) {
                label = LocalizationUtility.makePseudoFriendlyName(fieldName);
            }
            else {
                label = "Label could not find localized field name and had no body nor name attribute.";
            }
        }

        // Write out the tag
        writeOpenTag(getPageContext().getOut(), "label");
        getPageContext().getOut().write(label);
        writeCloseTag(getPageContext().getOut(), "label");

        // Reset the field name so as to not screw up tag pooling
        if (this.nameSet) {
            super.setName(fieldName);
        }

        return EVAL_PAGE;
    }
    catch (IOException ioe) {
        throw new StripesJspException("Encountered an exception while trying to write to " +
            "the output from the stripes:label tag handler class, InputLabelTag.", ioe);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:42,代码来源:InputLabelTag.java

示例3: testBaseCase

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
@Test(groups="fast")
public void testBaseCase() throws Exception {
    String input = "Hello";
    String output = LocalizationUtility.makePseudoFriendlyName(input);
    Assert.assertEquals(output, input);
}
 
开发者ID:scarcher2,项目名称:stripes,代码行数:7,代码来源:LocalizationUtilityTest.java

示例4: testSimpleCase

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
@Test(groups="fast")
public void testSimpleCase() throws Exception {
    String input = "hello";
    String output = LocalizationUtility.makePseudoFriendlyName(input);
    Assert.assertEquals(output, "Hello");
}
 
开发者ID:scarcher2,项目名称:stripes,代码行数:7,代码来源:LocalizationUtilityTest.java

示例5: testWithPeriod

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
@Test(groups="fast")
public void testWithPeriod() throws Exception {
    String input = "bug.name";
    String output = LocalizationUtility.makePseudoFriendlyName(input);
    Assert.assertEquals(output, "Bug Name");
}
 
开发者ID:scarcher2,项目名称:stripes,代码行数:7,代码来源:LocalizationUtilityTest.java

示例6: testWithStudlyCaps

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
@Test(groups="fast")
public void testWithStudlyCaps() throws Exception {
    String input = "bugName";
    String output = LocalizationUtility.makePseudoFriendlyName(input);
    Assert.assertEquals(output, "Bug Name");
}
 
开发者ID:scarcher2,项目名称:stripes,代码行数:7,代码来源:LocalizationUtilityTest.java

示例7: testComplexName

import net.sourceforge.stripes.localization.LocalizationUtility; //导入方法依赖的package包/类
@Test(groups="fast")
public void testComplexName() throws Exception {
    String input = "bug.submittedBy.firstName";
    String output = LocalizationUtility.makePseudoFriendlyName(input);
    Assert.assertEquals(output, "Bug Submitted By First Name");
}
 
开发者ID:scarcher2,项目名称:stripes,代码行数:7,代码来源:LocalizationUtilityTest.java


注:本文中的net.sourceforge.stripes.localization.LocalizationUtility.makePseudoFriendlyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。