Skip to content

Commit

Permalink
Localize two more strings archesproject#1516
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jan 12, 2024
1 parent 0fa9510 commit 112be9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ define([
const reportDate = today.toLocaleDateString('en-US', options);
const physicalThingsDetailsArray = [...Object.values(physicalThingsDetails)];
const objectOfStudyDetailsArray = physicalThingsDetailsArray.filter(thing => physicalThingFromPreviousStep.includes(thing.resourceinstanceid));
// TODO(i18n) samples
const analysisAreas = physicalThingsDetailsArray.filter(physicalThing => physicalThing.resource?.type?.["@display_value"] == 'analysis areas');
const annotationScreenshots = screenshots?.map((screenshot) => {
const url = `${window.location.origin}/temp_file/${screenshot.fileId}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ define([
});

this.samplingDate.subscribe(function(val){
// TODO(i18n) samples
self.samplingName(["Sampling Activity of", self.physicalThingNameValue, val].join(' '));
self.samplingName(arches.translations.samplingActivityOf.replace('{physicalThingName}', self.physicalThingNameValue) + ' ' + val);
});

const selectPhysThingData = params.selectPhysThingData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ define([
self.instrumentInstance(self.createRelatedInstance(val, instrumentUsedInObservation, observationInstrumentUsedIn));
instrumentData.then(function(data){
self.instrumentName(data._source.displayname);
// TODO(i18n) samples
self.nameValue(`Observation of ${physThingName} with ${data._source.displayname} ${self.dateValue()}`);
const formattedName = arches.translations.observationWith
.replace('{physicalThingName}', physThingName)
.replace('{instrumentName}', data._source.displayname);
self.nameValue(`${formattedName} ${self.dateValue()}`);
});
}
if (!val) {
Expand All @@ -119,8 +121,10 @@ define([

this.dateValue.subscribe(function(val){
if (self.instrumentName()) {
// TODO(i18n) samples
self.nameValue(`Observation of ${physThingName} with ${self.instrumentName()} ${val}`);
const formattedName = arches.translations.observationWith
.replace('{physicalThingName}', physThingName)
.replace('{instrumentName}', self.instrumentName());
self.nameValue(`${formattedName} ${val}`);
}
});

Expand Down
2 changes: 2 additions & 0 deletions arches_for_science/templates/javascript.htm
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,15 @@
analysis-areas='"{{ analysisAreas|pluralize }}"'
analysis-area-of='{% trans "{analysisName} [Analysis Area of {physicalThingName}]" as analysisAreaOf %} "{{ analysisAreaOf|escapejs }}"'
sample-of='{% trans "{sampleName} [Sample of {physicalThingName}]" as sampleOf %} "{{ sampleOf|escapejs }}"'
sampling-activity-of='{% trans "Sampling Activity of {physicalThingName}" as samplingActivityOf %} "{{ samplingActivityOf|escapejs }}"'
no-modifiying-areas='{% trans "Analysis Areas may not be modified in the sample taking workflow" as noModifyingAreas %} "{{ noModifyingAreas|escapejs }}"'
sample-location='{% trans "Sample Location" as sampleLocation %} "{{ sampleLocation|escapejs }}"'
no-modifying-samples='{% trans "Sample locations may not be modified in the analysis area workflow" as noModifyingSamples %} "{{ noModifyingSamples|escapejs }}"'
physical-thing-placeholder='{% trans "find a physical thing: enter an artist, object name, artwork title or object number" as physicalThingPlaceholder %} "{{ physicalThingPlaceholder|escapejs }}"'
annotation-summary-for='{% trans "Annotation Summary for" as annotationSummaryFor %} "{{ annotationSummaryFor|escapejs }}"'
existing-annotation='{% trans "{title} is a {type} of {parent},\n which is created before" as existingAnnotation %} "{{ existingAnnotation|escapejs }}"'
timespan='{% trans "TimeSpan" as timespan %} "{{ timespan|escapejs }}"'
observation-with='{% trans "Observation of {physicalThingName} with {instrumentName}" as observationWith %} "{{ observationWith|escapejs }}"'
></div>
{% endblock arches_translations %}

Expand Down

0 comments on commit 112be9a

Please sign in to comment.