Ejemplo n.º 1
0
 public static void fixTag(
     SourceTextEntry ste, Tag tag, TagError error, StringBuilder translation, String source) {
   List<Tag> tags;
   switch (error) {
     case DUPLICATE:
     case ORDER:
     case MALFORMED:
       tags = TagUtil.buildTagList(source, ste.getProtectedParts());
       fixMalformed(tags, translation, tag);
       break;
     case MISSING:
       tags = TagUtil.buildTagList(source, ste.getProtectedParts());
       fixMissing(tags, translation, tag);
       break;
     case EXTRANEOUS:
       fixExtraneous(translation, tag);
       break;
     case ORPHANED:
       // This is fixed by fixing MISSING.
       break;
     case WHITESPACE:
       fixWhitespace(translation, source);
       break;
     default:
       break;
   }
 }
Ejemplo n.º 2
0
  /**
   * Identify all the placeholders in the source text and automatically inserts them into the target
   * text.
   */
  public void editTagPainterMenuItemActionPerformed() {
    SourceTextEntry ste = Core.getEditor().getCurrentEntry();

    // insert tags
    String tr = Core.getEditor().getCurrentTranslation();
    for (ProtectedPart pp : ste.getProtectedParts()) {
      if (!tr.contains(pp.getTextInSourceSegment())) {
        Core.getEditor().insertText(pp.getTextInSourceSegment());
      }
    }
  }
Ejemplo n.º 3
0
  public void editExportSelectionMenuItemActionPerformed() {
    if (!Core.getProject().isProjectLoaded()) return;

    String selection = Core.getEditor().getSelectedText();
    if (selection == null) {
      SourceTextEntry ste = Core.getEditor().getCurrentEntry();
      TMXEntry te = Core.getProject().getTranslationInfo(ste);
      if (te.isTranslated()) {
        selection = te.translation;
      } else {
        selection = ste.getSrcText();
      }
    }

    FileUtil.writeScriptFile(selection, OConsts.SELECTION_EXPORT);
  }
Ejemplo n.º 4
0
  public void editTagNextMissedMenuItemActionPerformed() {
    String trans = Core.getEditor().getCurrentTranslation();
    if (trans == null) {
      return;
    }

    SourceTextEntry ste = Core.getEditor().getCurrentEntry();

    // insert next tag
    String tr = Core.getEditor().getCurrentTranslation();
    for (ProtectedPart pp : ste.getProtectedParts()) {
      if (!tr.contains(pp.getTextInSourceSegment())) {
        Core.getEditor().insertText(pp.getTextInSourceSegment());
        break;
      }
    }
  }