Package com.google.i18n.pseudolocalization.message

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


      int start = 0;
      while (m.find()) {
        String plainText = text.substring(start, m.start());
        start = m.end();
        if (plainText.length() > 0) {
          list.add(new SimpleTextFragment(plainText));
        }
        list.add(new MessageFormatPlaceholder(m.group()));
      }
      String plainText = text.substring(start);
      if (plainText.length() > 0) {
        list.add(new SimpleTextFragment(plainText));
      }
      return list;
    }
View Full Code Here


   * @throws PseudolocalizationException
   */
  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

        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

    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 "
View Full Code Here

public class ExpanderTest extends PseudolocalizationTestCase {

  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.SimpleTextFragment

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.