Skip to content

Commit

Permalink
inception-project#4068 - Ability to change interface language (i18n)
Browse files Browse the repository at this point in the history
 - Update from upstream branch
  • Loading branch information
awachatilf committed May 27, 2024
1 parent 617e248 commit ea734d8
Show file tree
Hide file tree
Showing 83 changed files with 575 additions and 463 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div wicket:id="preferencesDialog"></div>
<div class="action-bar-group">
<div class="btn-group">
<button wicket:id="showPreferencesDialog" class="btn btn-light" type="button" wicket:message="title:preferences">
<button wicket:id="showPreferencesDialog" class="btn btn-action-bar" type="button" wicket:message="title:preferences">
<i class="fas fa-cog" aria-hidden="true"></i>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.model.IModel;

import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.curation.config.CurationServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.curation.merge.strategy.DefaultMergeStrategy;
import de.tudarmstadt.ukp.inception.curation.model.CurationWorkflow;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.model.IModel;

import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.curation.config.CurationServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.curation.merge.strategy.MergeIncompleteStrategy;
import de.tudarmstadt.ukp.inception.curation.model.CurationWorkflow;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;

import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.curation.config.CurationServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.curation.merge.strategy.MergeStrategy;
import de.tudarmstadt.ukp.inception.curation.merge.strategy.ThresholdBasedMergeStrategy;
import de.tudarmstadt.ukp.inception.curation.model.CurationWorkflow;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.curation.config.CurationServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.ui.core.dashboard.settings.ProjectSettingsMenuItemBase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelFactory;
import de.tudarmstadt.ukp.inception.curation.config.CurationServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div wicket:id="guidelinesDialog"></div>
<div class="action-bar-group">
<div class="btn-group">
<button wicket:id="showGuidelinesDialog" class="btn btn-light" type="button" wicket:message="title:guidelines">
<button wicket:id="showGuidelinesDialog" class="btn btn-action-bar" type="button" wicket:message="title:guidelines">
<i class="fas fa-book" aria-hidden="true"></i>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.springframework.stereotype.Component;

import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelFactory;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

@Component
@Order(GuidelinesProjectSettingsPanelFactory.ORDER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.ui.core.dashboard.settings.ProjectSettingsMenuItemBase;

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,62 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.inception.recommendation.evaluation;
package de.tudarmstadt.ukp.inception.processing;

import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.MANAGER;
import static java.lang.String.format;

import javax.servlet.ServletContext;

import org.apache.wicket.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.core.annotation.Order;

import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import de.tudarmstadt.ukp.clarin.webanno.api.ProjectService;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.menu.ProjectMenuItem;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
import de.tudarmstadt.ukp.inception.recommendation.config.RecommenderServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.project.api.ProjectService;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import wicket.contrib.input.events.key.KeyType;

/**
* <p>
* This class is exposed as a Spring Component via
* {@link RecommenderServiceAutoConfiguration#evaluationSimulationPageMenuItem()}.
* </p>
*/
@Order(300)
public class EvaluationSimulationPageMenuItem
@ConditionalOnWebApplication
@Order(200)
public class BulkProcessingPageMenuItem
implements ProjectMenuItem
{
private @Autowired UserDao userRepo;
private @Autowired ProjectService projectService;
private @Autowired RecommendationService recommenderService;
private final UserDao userRepo;
private final ProjectService projectService;
private final ServletContext servletContext;

public BulkProcessingPageMenuItem(UserDao aUserRepo, ProjectService aProjectService,
ServletContext aServletContext)
{
userRepo = aUserRepo;
projectService = aProjectService;
servletContext = aServletContext;
}

@Override
public String getPath()
{
return "/evaluation";
return "/process";
}

public String getUrl(Project aProject, long aDocumentId)
{
String p = aProject.getSlug() != null ? aProject.getSlug()
: String.valueOf(aProject.getId());

return format("%s/p/%s%s/%d", servletContext.getContextPath(), p, getPath(), aDocumentId);
}

@Override
public IconType getIcon()
{
return FontAwesome5IconType.chart_line_s;
return FontAwesome5IconType.robot_s;
}

@Override
Expand All @@ -70,24 +82,23 @@ public String getLabel()
@Override
public boolean applies(Project aProject)
{
// Visible if the current user is a curator
User user = userRepo.getCurrentUser();
if (!(projectService.hasRole(user, aProject, MANAGER))) {
if (aProject == null) {
return false;
}

return !recommenderService.listRecommenders(aProject).isEmpty();
User user = userRepo.getCurrentUser();
return projectService.hasRole(user, aProject, MANAGER);
}

@Override
public Class<? extends Page> getPageClass()
{
return EvaluationSimulationPage.class;
return BulkProcessingPage.class;
}

@Override
public KeyType[] shortcut()
{
return new KeyType[] { KeyType.Alt, KeyType.s };
return new KeyType[] { KeyType.Alt, KeyType.p };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelFactory;
import de.tudarmstadt.ukp.inception.project.export.config.ProjectExportServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelFactory;
import de.tudarmstadt.ukp.inception.project.export.config.ProjectExportServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.recommendation.config.RecommenderServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.ui.core.dashboard.settings.ProjectSettingsMenuItemBase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelFactory;
import de.tudarmstadt.ukp.inception.recommendation.config.RecommenderServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
page.title=Evaluation
apiKey=API key
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelFactory;
import de.tudarmstadt.ukp.inception.sharing.config.InviteServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.sharing.config.InviteServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.inception.ui.core.dashboard.settings.ProjectSettingsMenuItemBase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
</div>
</wicket:extend>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ projects.label = Projects

settings = Settings

run=Calculate...
calculatePairwiseAgreement = Pairwise...
calculatePerDocumentAgreement = Per document...
export = Export diff...
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.menu.ProjectMenuItem;
import de.tudarmstadt.ukp.inception.project.api.ProjectService;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import wicket.contrib.input.events.key.KeyType;

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package de.tudarmstadt.ukp.clarin.webanno.ui.annotation;

import static de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase.PAGE_PARAM_DATA_OWNER;
import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.ANNOTATOR;
import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.CURATOR;
import static java.lang.String.format;
Expand All @@ -28,13 +29,12 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import de.tudarmstadt.ukp.clarin.webanno.api.ProjectService;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.config.AnnotationUIAutoConfiguration;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.menu.ProjectMenuItem;
import de.tudarmstadt.ukp.inception.project.api.ProjectService;
import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
import wicket.contrib.input.events.key.KeyType;

/**
Expand Down Expand Up @@ -67,12 +67,19 @@ public String getPath()

public String getUrl(Project aProject, long aDocumentId)
{
String p = aProject.getSlug() != null ? aProject.getSlug()
: String.valueOf(aProject.getId());
var p = aProject.getSlug() != null ? aProject.getSlug() : String.valueOf(aProject.getId());

return format("%s/p/%s%s/%d", servletContext.getContextPath(), p, getPath(), aDocumentId);
}

public String getUrl(Project aProject, long aDocumentId, String aDataOwner)
{
var p = aProject.getSlug() != null ? aProject.getSlug() : String.valueOf(aProject.getId());

return format("%s/p/%s%s/%d?%s=%s", servletContext.getContextPath(), p, getPath(),
aDocumentId, PAGE_PARAM_DATA_OWNER, aDataOwner);
}

@Override
public IconType getIcon()
{
Expand All @@ -96,8 +103,8 @@ public boolean applies(Project aProject)
}

// Visible if the current user is an annotator
User user = userRepo.getCurrentUser();
return projectService.hasRole(user, aProject, ANNOTATOR, CURATOR);
var sessionOwner = userRepo.getCurrentUser();
return projectService.hasRole(sessionOwner, aProject, ANNOTATOR, CURATOR);
}

@Override
Expand Down
Loading

0 comments on commit ea734d8

Please sign in to comment.