Package com.google.i18n.pseudolocalization.message

Examples of com.google.i18n.pseudolocalization.message.SimpleNonlocalizableTextFragment


   */
  protected String runPreparsedHtml(PseudolocalizationPipeline pipeline)
      throws PseudolocalizationException {
    SimpleMessage msg = new SimpleMessage(Arrays.<MessageFragment>asList(
        new SimpleTextFragment("Hello "),
        new SimpleNonlocalizableTextFragment("<br>"),
        new SimpleTextFragment(" there"))) { };
    pipeline.localize(msg);
    return msg.getText();
  }
View Full Code Here


  private static class Mangler extends DefaultVisitor implements PseudolocalizationMethod {

    @Override
    public void visitTextFragment(VisitorContext ctx, TextFragment fragment) {
      ctx.insertBefore(fragment, new SimpleNonlocalizableTextFragment("[loc:"));
      ctx.insertAfter(fragment, new SimpleNonlocalizableTextFragment("]"));
    }
View Full Code Here

    assertEquals("Non-empty string not detected as RTL via first-strong: " + bidi.toString(),
        input.isEmpty(), bidi.isLeftToRight());
  }

  private void runHtmlTest(String input, String expected) throws PseudolocalizationException {
    String result = runPipeline(pipeline, new SimpleNonlocalizableTextFragment(HTML_START),
        new SimpleTextFragment(input),
        new SimpleNonlocalizableTextFragment(HTML_END));
    assertEquals(HTML_START + expected + HTML_END, result);
    // TODO(jat): figure out a way to detect how a browser would apply first-strong
  }
View Full Code Here

  public void testHtml() throws Exception {
    runHtmlTest("", "");
    runHtmlTest("Google", "\u200f\u202eGoogle\u202c\u200f");

    List<MessageFragment> fragments = new ArrayList<MessageFragment>();
    fragments.add(new SimpleNonlocalizableTextFragment("<a href=\"http://chucknorrisfacts.fr/\">"
        + "<strong>"));
    fragments.add(new SimpleTextFragment("Chuck Norris"));
    fragments.add(new SimpleNonlocalizableTextFragment("</strong>"));
    fragments.add(new SimpleTextFragment(" peut diviser par zéro."));
    fragments.add(new SimpleNonlocalizableTextFragment("</a>"));
    String result = runPipeline(pipeline, fragments);
    assertEquals("<a href=\"http://chucknorrisfacts.fr/\">"
         + "<strong>\u200f\u202eChuck\u202c\u200f \u200f\u202eNorris\u202c\u200f</strong> "
         + "\u200f\u202epeut\u202c\u200f \u200f\u202ediviser\u202c\u200f "
         + "\u200f\u202epar\u202c\u200f \u200f\u202ezéro\u202c\u200f.</a>", result);
View Full Code Here

  public void testArg() throws PseudolocalizationException {
    PseudolocalizationPipeline pipeline = PseudolocalizationPipeline.buildPipeline(
        "expand:threshold=1");
    String result = runPipeline(pipeline, new SimpleTextFragment("a "),
        new SimpleNonlocalizableTextFragment("<br>"),
        new SimpleTextFragment(" b"));
    assertEquals("a <br> b one", result);
  }
View Full Code Here

TOP

Related Classes of com.google.i18n.pseudolocalization.message.SimpleNonlocalizableTextFragment

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.