Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
#issue 265: add interface CopyTransService
Browse files Browse the repository at this point in the history
  • Loading branch information
hding committed May 13, 2011
1 parent 221b1bb commit a2becb7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
Expand Up @@ -891,7 +891,7 @@ private void validateExtensions(String... extensions)

public void copyClosestEquivalentTranslation(Long docId, String name, String projectSlug, String iterationSlug)
{
Events.instance().raiseTransactionSuccessEvent(EVENT_COPY_TRANS, docId, projectSlug, iterationSlug);
Events.instance().raiseAsynchronousEvent(EVENT_COPY_TRANS, docId, projectSlug, iterationSlug);
}

}
@@ -0,0 +1,29 @@
/*
* Copyright 2010, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.zanata.service;

import org.zanata.model.HDocument;
import org.zanata.model.HLocale;

public interface CopyTransService
{
void copyTransForLocale(HDocument document, HLocale locale);
}
Expand Up @@ -40,12 +40,13 @@
import org.zanata.model.HTextFlow;
import org.zanata.model.HTextFlowTarget;
import org.zanata.rest.service.TranslationResourcesService;
import org.zanata.service.CopyTransService;
import org.zanata.service.LocaleService;

@Name("copyTransService")
@Name("copyTransServiceImpl")
@AutoCreate
@Scope(ScopeType.STATELESS)
public class CopyTransService
public class CopyTransServiceImpl implements CopyTransService
{
@In
private LocaleService localeServiceImpl;
Expand Down Expand Up @@ -90,7 +91,7 @@ private String createComment(HTextFlowTarget target)
return "translation auto-copied from project " + projectname + ", version " + version + ", document " + documentid + ", author " + authorname;
}

private void copyTransForLocale(HDocument document, HLocale locale)
public void copyTransForLocale(HDocument document, HLocale locale)
{
try
{
Expand All @@ -104,7 +105,6 @@ private void copyTransForLocale(HDocument document, HLocale locale)
HTextFlowTarget oldTFT = textFlowTargetDAO.findLatestEquivalentTranslation(textFlow, locale);
if (oldTFT != null)
{
log.info("find one:" + oldTFT.getContent());
if (hTarget == null)
{
hTarget = new HTextFlowTarget(textFlow, locale);
Expand Down

0 comments on commit a2becb7

Please sign in to comment.