Skip to content

Commit

Permalink
Merge pull request #4 from hove-io/arb_fix-lang1
Browse files Browse the repository at this point in the history
Translation of logs
  • Loading branch information
aboivert authored Jan 7, 2025
2 parents 706e515 + 336777f commit 906ef93
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion configurations/default/server.yml.tmp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
application:
title: Data Tools
title: DataHub Editor
logo: https://d2tyb7byn1fef9.cloudfront.net/ibi_group-128x128.png
logo_large: https://d2tyb7byn1fef9.cloudfront.net/ibi_group_black-512x512.png
client_assets_url: https://example.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void run () {
// Calculate completion based on number of sub jobs remaining.
double percentComplete = subJobNumber * 100D / subJobsTotal;
// Run sub-task if no error has errored during parent job or previous sub-task execution.
status.update(String.format("Waiting on %s...", subJobName), percentComplete);
status.update(String.format("Opération %s en cours", subJobName), percentComplete);
subJob.run();
// Record if there has been an error in the execution of the sub-task. (Note: this will not
// incorrectly overwrite a 'true' value with 'false' because the sub-task is only run if
Expand All @@ -199,7 +199,7 @@ public void run () {
cancel(cancelMessage);
}
// Complete the job (as success if no errors encountered, as failure otherwise).
if (!parentJobErrored && !subTaskErrored) status.completeSuccessfully("Job complete!");
if (!parentJobErrored && !subTaskErrored) status.completeSuccessfully("Opération réussie !");
else status.complete(true);
// Run final steps of job pending completion or error. Note: any tasks that depend on job success should
// check job status in jobFinished to determine if final step should be executed (e.g., storing feed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private static String createSnapshot (Request req, Response res) throws IOExcept
}
// Begin asynchronous execution.
JobUtils.heavyExecutor.execute(createSnapshotJob);
return SparkUtils.formatJobMessage(createSnapshotJob.jobId, "Creating snapshot.");
return SparkUtils.formatJobMessage(createSnapshotJob.jobId, "Opération réussie !");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class CreateSnapshotJob extends MonitorableJob {
private FeedSource feedSource;

public CreateSnapshotJob(Auth0UserProfile owner, Snapshot snapshot, boolean updateBufferNamespace, boolean storeSnapshot, boolean preserveBufferAsSnapshot) {
super(owner, "Creating snapshot for " + snapshot.feedSourceId, JobType.CREATE_SNAPSHOT);
super(owner, "Création d'un instantané pour " + snapshot.feedSourceId, JobType.CREATE_SNAPSHOT);
this.namespace = snapshot.snapshotOf;
this.snapshot = snapshot;
this.updateBuffer = updateBufferNamespace;
Expand All @@ -83,7 +83,7 @@ public CreateSnapshotJob(Auth0UserProfile owner, Snapshot snapshot, boolean upda
}

public CreateSnapshotJob(Auth0UserProfile owner, Snapshot snapshot) {
super(owner, "Creating snapshot for " + snapshot.feedSourceId, JobType.CREATE_SNAPSHOT);
super(owner, "Création d'un instantané pour " + snapshot.feedSourceId, JobType.CREATE_SNAPSHOT);
this.snapshot = snapshot;
this.updateBuffer = false;
this.storeSnapshot = true;
Expand All @@ -108,10 +108,10 @@ public void jobLogic() {
// Get count of snapshots to set new version number.
feedSource = Persistence.feedSources.getById(snapshot.feedSourceId);
// Update job name to use feed source name (rather than ID).
this.name = String.format("Creating snapshot for %s", feedSource.name);
this.name = String.format("Création d'un instantané pour %s", feedSource.name);
Collection<Snapshot> existingSnapshots = feedSource.retrieveSnapshots();
int version = existingSnapshots.size();
status.update("Creating snapshot...", 20);
status.update("Création d'un instantané...", 20);
FeedLoadResult loadResult = makeSnapshot(namespace, DataManager.GTFS_DATA_SOURCE, !feedSource.preserveStopTimesSequence);
snapshot.version = version;
snapshot.namespace = loadResult.uniqueIdentifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public class ExportSnapshotToGTFSJob extends MonitorableJob {
private final boolean publishProprietaryFiles;

public ExportSnapshotToGTFSJob(Auth0UserProfile owner, Snapshot snapshot, FeedVersion feedVersion, boolean publishProprietaryFiles) {
super(owner, "Exporting snapshot " + snapshot.name, JobType.EXPORT_SNAPSHOT_TO_GTFS);
super(owner, "Export de l'instantané " + snapshot.name, JobType.EXPORT_SNAPSHOT_TO_GTFS);
this.snapshot = snapshot;
this.feedVersion = feedVersion;
this.publishProprietaryFiles = publishProprietaryFiles;
status.update("Starting database snapshot...", 10);
status.update("Ouverture de l'instantané...", 10);
}

public ExportSnapshotToGTFSJob(Auth0UserProfile owner, Snapshot snapshot, boolean publishProprietaryFiles) {
Expand All @@ -56,13 +56,13 @@ public void jobLogic() {
tempFile = File.createTempFile("snapshot", "zip");
} catch (IOException e) {
e.printStackTrace();
status.fail("Error creating local file for snapshot.", e);
status.fail("Erreur lors de la création du fichier depuis l'instantané", e);
return;
}
JdbcGtfsExporter exporter = new JdbcGtfsExporter(snapshot.namespace, tempFile.getAbsolutePath(), DataManager.GTFS_DATA_SOURCE, true, publishProprietaryFiles);
FeedLoadResult result = exporter.exportTables();
if (result.fatalException != null) {
status.fail(String.format("Error (%s) encountered while exporting database tables.", result.fatalException));
status.fail(String.format("Erreur (%s) rencontrée lors de l'export.", result.fatalException));
return;
}

Expand All @@ -71,7 +71,7 @@ public void jobLogic() {
String bucketPrefix = isNewVersion ? "gtfs" : "snapshots";
// FIXME: replace with use of refactored FeedStore.
// Store the GTFS zip locally or on s3.
status.update("Writing snapshot to GTFS file", 90);
status.update("Ecriture de l'instantané dans le GTFS", 90);
if (DataManager.useS3) {
String s3Key = String.format("%s/%s", bucketPrefix, filename);
try {
Expand All @@ -93,7 +93,7 @@ public void jobLogic() {

@Override
public void jobFinished () {
if (!status.error) status.completeSuccessfully("Export complete!");
if (!status.error) status.completeSuccessfully("Export complété !");
// Delete snapshot temp file.
if (tempFile != null) {
LOG.info("Deleting temporary GTFS file for exported snapshot at {}", tempFile.getAbsolutePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Auth0UserProfile(String email, String user_id) {
* Utility method for creating a test admin (with application-admin permissions) user.
*/
public static Auth0UserProfile createTestAdminUser() {
return createAdminUser("[email protected]", "user_id:string");
return createAdminUser("[email protected]", "user_id:string");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private static void loadLegacyFeedVersion (JsonNode node) {
* that needs to be applied to all feeds.
*/
public static boolean validateAll (boolean load, boolean force, String filterFeedId) throws Exception {
LOG.info("validating all feeds...");
LOG.info("Validation des flux");
Collection<FeedVersion> allVersions = Persistence.feedVersions.getAll();
for(FeedVersion version: allVersions) {
ValidationResult result = version.validationResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public class CreateFeedVersionFromSnapshotJob extends FeedSourceJob {
private final boolean publishProprietaryFiles;

public CreateFeedVersionFromSnapshotJob(FeedSource feedSource, Snapshot snapshot, Auth0UserProfile owner, boolean publishProprietaryFiles) {
super(owner, "Creating Feed Version from Snapshot for " + feedSource.name, JobType.CREATE_FEEDVERSION_FROM_SNAPSHOT);
super(owner, "Création d'une version depuis un instantané pour " + feedSource.name, JobType.CREATE_FEEDVERSION_FROM_SNAPSHOT);
this.feedVersion = new FeedVersion(feedSource, snapshot);
this.snapshot = snapshot;
this.publishProprietaryFiles = publishProprietaryFiles;
}

@Override
public void jobLogic() {
status.update("Exporting snapshot to GTFS...", 10);
status.update("Export de l’instantané", 10);
// Add the jobs to handle this operation in order.
addNextJob(
// First export the snapshot to GTFS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public class LoadFeedJob extends FeedVersionJob {
private final boolean isNewVersion;

public LoadFeedJob(FeedVersion version, Auth0UserProfile owner, boolean isNewVersion) {
super(owner, "Loading GTFS", JobType.LOAD_FEED);
super(owner, "Chargement du GTFS", JobType.LOAD_FEED);
feedVersion = version;
this.isNewVersion = isNewVersion;
status.update("Waiting to load feed...", 0);
status.update("Chargement en cours...", 0);
}

/**
Expand All @@ -49,7 +49,7 @@ public void jobLogic () {
@Override
public void jobFinished () {
if (!status.error) {
status.completeSuccessfully("Load stage complete!");
status.completeSuccessfully("Chargement terminé !");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class NotifyUsersForSubscriptionJob implements Runnable {
private String subscriptionType;
private String target;
private String message;
private static final String DEFAULT_NAME = "Data Tools";
private static final String DEFAULT_NAME = "DataHub Editor";
private static final String APPLICATION_NAME = DataManager.getConfigPropertyAsText("application.title");
private static final String APPLICATION_URL = DataManager.getConfigPropertyAsText("application.public_url");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public class ProcessSingleFeedJob extends FeedVersionJob {
* Create a job for the given feed version.
*/
public ProcessSingleFeedJob(FeedVersion feedVersion, Auth0UserProfile owner, boolean isNewVersion) {
super(owner, "Processing GTFS for " + (feedVersion.parentFeedSource() != null ? feedVersion.parentFeedSource().name : "unknown feed source"), JobType.PROCESS_FEED);
super(owner, "Traitement GTFS pour " + (feedVersion.parentFeedSource() != null ? feedVersion.parentFeedSource().name : "source inconnue"), JobType.PROCESS_FEED);
this.feedVersion = feedVersion;
this.feedSource = feedVersion.parentFeedSource();
this.isNewVersion = isNewVersion;
status.update("Waiting...", 0);
status.update("En cours...", 0);
status.uploading = true;
}

Expand Down Expand Up @@ -85,7 +85,7 @@ public String getFeedSourceId() {
*/
@Override
public void jobLogic() {
LOG.info("Processing feed for {}", feedVersion.id);
LOG.info("Traitement du flux pour {}", feedVersion.id);
FeedTransformRules rules = feedSource.getRulesForRetrievalMethod(feedVersion.retrievalMethod);
boolean shouldTransform = rules != null;
if (shouldTransform) {
Expand Down Expand Up @@ -171,9 +171,9 @@ public void jobLogic() {
@Override
public void jobFinished() {
if (!status.error) {
status.completeSuccessfully("New version saved.");
status.completeSuccessfully("Nouvelle version enregistrée.");
} else {
LOG.warn("Error processing version {} because of {}.", feedVersion.id, getErrorReasonMessage());
LOG.warn("Erreur de traitement de la version {} ({}).", feedVersion.id, getErrorReasonMessage());
}
// Send notification to those subscribed to feed version updates.
NotifyUsersForSubscriptionJob.createNotification(
Expand All @@ -188,8 +188,8 @@ public void jobFinished() {
*/
private String getErrorReasonMessage() {
return status.exceptionType != null
? String.format("error due to %s", status.exceptionType)
: "unknown error";
? String.format("erreur %s", status.exceptionType)
: "erreur inconnue";
}

/**
Expand All @@ -199,7 +199,7 @@ private String getErrorReasonMessage() {
public String getNotificationMessage() {
StringBuilder message = new StringBuilder();
if (!status.error) {
message.append(String.format("New feed version created for %s (valid from %s - %s). ",
message.append(String.format("Nouvelle version créée pour %s (valide du %s au %s).",
feedSource.name,
feedVersion.validationResult.firstCalendarDate,
feedVersion.validationResult.lastCalendarDate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class ValidateFeedJob extends FeedVersionJob {
private final boolean isNewVersion;

public ValidateFeedJob(FeedVersion version, Auth0UserProfile owner, boolean isNewVersion) {
super(owner, "Validating Feed", JobType.VALIDATE_FEED);
super(owner, "Validation du flux", JobType.VALIDATE_FEED);
feedVersion = version;
this.isNewVersion = isNewVersion;
status.update("Waiting to begin validation...", 0);
status.update("En attente de la validation...", 0);
}

@Override
public void jobLogic () {
LOG.info("Running ValidateFeedJob for {}", feedVersion.id);
LOG.info("Opération ValidateFeedJob en cours pour {}", feedVersion.id);
feedVersion.validate(status);
}

Expand All @@ -50,7 +50,7 @@ public void jobFinished () {
}
// TODO: If ValidateFeedJob is called without a parent job (e.g., to "re-validate" a feed), we should handle
// storing the updated ValidationResult in Mongo.
status.completeSuccessfully("Validation finished!");
status.completeSuccessfully("Validation terminée!");
} else {
// If the version was not stored successfully, call FeedVersion#delete to reset things to before the version
// was uploaded/fetched. Note: delete calls made to MongoDB on the version ID will not succeed, but that is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public class ValidateMobilityDataFeedJob extends FeedVersionJob {
private final boolean isNewVersion;

public ValidateMobilityDataFeedJob(FeedVersion version, Auth0UserProfile owner, boolean isNewVersion) {
super(owner, "Validating Feed using MobilityData", JobType.VALIDATE_FEED);
super(owner, "Validation du flux par MobilityData", JobType.VALIDATE_FEED);
feedVersion = version;
this.isNewVersion = isNewVersion;
status.update("Waiting to begin MobilityData validation...", 0);
status.update("En attente de la validation MobilityData...", 0);
}

@Override
public void jobLogic () {
LOG.info("Running ValidateMobilityDataFeedJob for {}", feedVersion.id);
LOG.info("Opération ValidateMobilityDataFeedJob en cours pour {}", feedVersion.id);
feedVersion.validateMobility(status);
}

Expand All @@ -42,7 +42,7 @@ public void jobFinished () {
// the version won't get loaded into MongoDB (even though it exists in postgres).
feedVersion.persistFeedVersionAfterValidation(isNewVersion);
}
status.completeSuccessfully("MobilityData validation finished!");
status.completeSuccessfully("Validation MobilityData terminée");
} else {
// If the version was not stored successfully, call FeedVersion#delete to reset things to before the version
// was uploaded/fetched. Note: delete calls made to MongoDB on the version ID will not succeed, but that is
Expand Down
Loading

0 comments on commit 906ef93

Please sign in to comment.