Skip to content

Commit

Permalink
Make i18n changes consistent with 4a10968, 6cf200a, a6a9e83 (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed May 2, 2022
1 parent d7d0d31 commit 193f053
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 49 deletions.
10 changes: 5 additions & 5 deletions frontend/src/panel-source/source-metadata-panel-template.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="panel-header">
<h4 class="title is-4">{{#i18n 'source_meta_summary'}}Source {{identifier}}, created by {{creator}} at {{dateUploaded}}{{/i18n}}</h4>
<h4 class="title is-4">{{#i18n 'source.meta-summary'}}Source {{identifier}}, created by {{creator}} at {{dateUploaded}}{{/i18n}}</h4>
</div>
<div class="panel-content">
<!-- source-metadata will be rendered here-->
</div>
<div class="panel-footer buttons is-right">{{#userIsOwner}}
<button type=button class="button btn-delete is-danger edit-mode">{{#i18n 'delete_source'}}Delete source{{/i18n}}</button>
<button type="submit" class="button btn-save edit-mode">{{#i18n 'save_changes'}}Save changes{{/i18n}}</button>
<button type=reset class="button btn-cancel edit-mode">{{#i18n 'cancel'}}Cancel{{/i18n}}</button>
<button type=button class="button btn-edit">{{#i18n 'edit'}}Edit{{/i18n}}</button>
<button type=button class="button btn-delete is-danger edit-mode">{{#i18n 'button.delete-source'}}Delete source{{/i18n}}</button>
<button type="submit" class="button btn-save edit-mode">{{#i18n 'button.save-changes'}}Save changes{{/i18n}}</button>
<button type=reset class="button btn-cancel edit-mode">{{#i18n 'button.cancel'}}Cancel{{/i18n}}</button>
<button type=button class="button btn-edit">{{#i18n 'button.edit'}}Edit{{/i18n}}</button>
{{/userIsOwner}}</div>
75 changes: 47 additions & 28 deletions frontend/src/source-metadata/source-metadata-template.hbs
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<div class="section source">
<div class="field">
<label class="label">{{#i18n 'title'}}Title{{/i18n}}</label>
<label class="label">{{#i18n 'label.title'}}Title{{/i18n}}</label>
<div class="control">
<input class="input" type="text" name="title" {{#unless readonly}}placeholder="The Voyage of the Dawn Treader"{{/unless}} required {{#readonly}}readonly{{/readonly}}>
</div>
</div>
<div class="field">
<label class="label">{{#i18n 'author'}}Author{{/i18n}}</label>
<label class="label">{{#i18n 'label.author'}}Author{{/i18n}}</label>
<div class="control">
<input name="author" class="input" type="text" {{#unless readonly}}placeholder="C.S. Lewis"{{/unless}} required {{#readonly}}readonly{{/readonly}}>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<label class="label">{{#i18n 'editor_opt'}}Editor (optional){{/i18n}}</label>
<label class="label">{{#i18n 'label.editor-opt'}}Editor (optional){{/i18n}}</label>
<input name="editor" class="input" type="text" {{#unless readonly}}placeholder="C.S. Lewis"{{/unless}} {{#readonly}}readonly{{/readonly}}>
</div>
<div class="control">
<label class="label">{{#i18n 'publisher_opt'}}Publisher (optional){{/i18n}}</label>
<label class="label">{{#i18n 'label.publisher-opt'}}Publisher (optional){{/i18n}}</label>
<input name="publisher" class="input" type="text" {{#unless readonly}}placeholder="Geoffrey Bles"{{/unless}} {{#readonly}}readonly{{/readonly}}>
</div>
</div>
<div class="field">
<label class="label">{{#i18n 'repository_opt'}}Repository (optional){{/i18n}}</label>
<label class="label">{{#i18n 'label.repository-opt'}}Repository (optional){{/i18n}}</label>
<div class="control">
<input
name="repository"
class="input"
type="text"
{{#unless readonly}}placeholder="{{#i18n 'repository_placeholder'}}Archive, location, collection, call, fasc, folio{{/i18n}}"{{/unless}}
{{#unless readonly}}placeholder="{{#i18n 'placeholder.repository'}}Archive, location, collection, call, fasc, folio{{/i18n}}"{{/unless}}
{{#readonly}}readonly{{/readonly}}
>
</div>
</div>
{{#upload}}
<div class="field">
<label class="label">{{#i18n 'file'}}File{{/i18n}}</label>
<label class="label">{{#i18n 'label.file'}}File{{/i18n}}</label>
<div class="file">
<label class="file-label has-helptext">
<input class="file-input" type="file" name="source" id="source">
Expand All @@ -44,44 +44,63 @@
<i class="fas fa-upload"></i>
</span>
<span class="file-label filelabel">
{{#i18n 'choose_file'}}Choose a file…{{/i18n}}
{{#i18n 'label.choose-file'}}Choose a file…{{/i18n}}
</span>
</span>
<span class="file-name">
{{#i18n 'no_file'}}No file selected{{/i18n}}
{{#i18n 'upload.no-file'}}No file selected{{/i18n}}
</span>
</label>
</div>
<p class="help">{{#i18n 'file_only_txt_utf8_lf'}}Only txt files in UTF-8 encoding (LF for line endings) are supported.{{/i18n}}</p>
<p class="help">{{#i18n 'upload.only-txt-utf8-lf'}}Only txt files in UTF-8 encoding (LF for line endings) are supported.{{/i18n}}</p>
</div>
{{/upload}}

<div class="field">
<label class="label">{{#i18n 'language'}}Language{{/i18n}}</label>
<label class="label">{{#i18n 'label.language'}}Language{{/i18n}}</label>
<div class="control" id="languageSelect">
{{#if readonly}}
<input name="language" class="input" type="text" readonly>
{{else}}
<div class="select has-helptext">
<select name='language' size='1'>
<option value="">{{#i18n 'select_language'}}Select language{{/i18n}}</option>
<option value="en">{{#i18n 'english'}}English{{/i18n}}</option>
<option value="de">{{#i18n 'german'}}German{{/i18n}}</option>
<option value="fr">{{#i18n 'french'}}French{{/i18n}}</option>
<option value="it">{{#i18n 'italian'}}Italian{{/i18n}}</option>
<option value="cs">{{#i18n 'czech'}}Czech{{/i18n}}</option>
<option value="nl">{{#i18n 'dutch'}}Dutch{{/i18n}}</option>
<option value="other">{{#i18n 'other'}}Other{{/i18n}}</option>
<option value="">
{{#i18n 'label.select-language'
}}Select language{{/i18n}}
</option>
<option value="en">
{{#i18n 'label.english'}}English{{/i18n}}
</option>
<option value="de">
{{#i18n 'label.german'}}German{{/i18n}}
</option>
<option value="fr">
{{#i18n 'label.french'}}French{{/i18n}}
</option>
<option value="it">
{{#i18n 'label.italian'}}Italian{{/i18n}}
</option>
<option value="cs">
{{#i18n 'label.czech'}}Czech{{/i18n}}
</option>
<option value="nl">
{{#i18n 'label.dutch'}}Dutch{{/i18n}}
</option>
<option value="other">
{{#i18n 'label.other'}}Other{{/i18n}}
</option>
</select>
</div>
{{/if}}
</div>
<p class="help">{{#i18n 'source_lang_select_help'}}If the source contains multiple languages,
please select 'Other'.{{/i18n}}</p>
<p class="help">
{{#i18n 'upload.source-lang-select-help'
}}If the source contains multiple languages, please select 'Other'.{{/i18n}}
</p>
</div>

<div class="field">
<label class="label">{{#i18n 'source_type'}}Type of source{{/i18n}}</label>
<label class="label">{{#i18n 'label.source-type'}}Type of source{{/i18n}}</label>
{{#if readonly}}
<div class="control">
<input name='sourceType' class="input" type="text" readonly>
Expand All @@ -90,27 +109,27 @@
<div class="control sourceTypeSelect">
</div>
{{/if}}
<p class="help">{{#i18n 'source_type_select_help'}}When in doubt, choose 'Unknown'.{{/i18n}}</p>
<p class="help">{{#i18n 'upload.source-type-select-help'}}When in doubt, choose 'Unknown'.{{/i18n}}</p>
</div>
<div class="dates">
{{!date fields with type-aware help will be rendered here}}
</div>
<div class="field">
<div class="control">
<label class="label">{{#i18n 'source_access'}}Source access{{/i18n}}</label>
<label class="label">{{#i18n 'label.source-access'}}Source access{{/i18n}}</label>
<label class="radio">
<input type="radio" name="public" value="public" checked>
{{#i18n 'public'}}Public{{/i18n}}
{{#i18n 'label.public'}}Public{{/i18n}}
</label>
<label class="radio">
<input type="radio" name="public" value="private">
{{#i18n 'private'}}Private{{/i18n}}
{{#i18n 'label.private'}}Private{{/i18n}}
</label>
<p class="help">{{#i18n 'public_private_help'}}Provide access to everyone (public) or only to authenticated users (private).{{/i18n}}</p>
<p class="help">{{#i18n 'upload.public-private-help'}}Provide access to everyone (public) or only to authenticated users (private).{{/i18n}}</p>
</div>
</div>
<div class="field url">
<label class="label">{{#i18n 'url_opt'}}URL (optional){{/i18n}}</label>
<label class="label">{{#i18n 'label.url-opt'}}URL (optional){{/i18n}}</label>
<div class="control">
<input name="url" class="input" type="url" {{#unless readonly}}placeholder="https://www.wikidata.org/wiki/Q331656"{{/unless}} {{#readonly}}readonly{{/readonly}}>
</div>
Expand Down
26 changes: 19 additions & 7 deletions frontend/src/source-metadata/source-metadata-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,35 @@ export default class SourceMetadataView extends CompositeView {
model: this.getNode('datePublished'),
name: 'datePublished',
required: true,
label: i18next.t('publication_date', 'Publication date'),
additionalHelpText: i18next.t('publication_date_help', `<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO formatted
date with optional time and timezone</a>, or free-form text`),
label: i18next.t('label.publication-date', 'Publication date'),
additionalHelpText: `
${i18next.t(
'upload.publication-date-help.begin'
)}<a
href="https://en.wikipedia.org/wiki/ISO_8601"
target="_blank"
>${i18next.t(
'upload.publication-date-help.link',
'ISO formatted date with optional time and timezone'
)}</a>${i18next.t(
'upload.publication-date-help.end',
', or free-form text'
)}
`),
readonly: this.readonly
});
this.creationDateField = new DateField({
model: this.getNode('dateCreated'),
name: 'dateCreated',
label: i18next.t('creation_date_opt', 'Creation date (optional)'),
additionalHelpText: i18next.t('creation_date_help', 'If known and different from publishing date, specify creation date.'),
label: i18next.t('label.creation-date-opt', 'Creation date (optional)'),
additionalHelpText: i18next.t('upload.creation-date-help', 'If known and different from publishing date, specify creation date.'),
readonly: this.readonly
});
this.retrievalDateField = new DateField({
model: this.getNode('dateRetrieved'),
name: 'dateRetrieved',
label: i18next.t('retrieval_date_opt', 'Retrieval date (optional)'),
additionalHelpText: i18next.t('retrieval_date_help', 'Date (and optional time) at which the source was accessed or retrieved.'),
label: i18next.t('label.retrieval-date-opt', 'Retrieval date (optional)'),
additionalHelpText: i18next.t('upload.retrieval-date-help', 'Date (and optional time) at which the source was accessed or retrieved.'),
readonly: this.readonly
});
this.render();
Expand Down
22 changes: 13 additions & 9 deletions frontend/src/upload/upload-source-template.hbs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<header>
<h3 class="title is-3 page-header">{{#i18n 'upload_source'}}Upload source{{/i18n}}</h3>
<h3 class="title is-3 page-header">{{#i18n 'upload.form-title'}}Upload source{{/i18n}}</h3>
</header>
<div class="section upload-source">

<div class="field form-feedback-bar has-background-success">
<p class="help">
{{#i18n 'upload_success_before_link'}}Source uploaded successfully! Upload another one or{{/i18n}}
<a href="/explore">{{#i18n 'upload_success_link'}}go to the Explorer{{/i18n}}</a>{{#i18n 'upload_success_after_link'}}.{{/i18n}}
{{#i18n 'upload.success.begin'
}}Source uploaded successfully! Upload another one or {{/i18n
}}<a href="/explore">{{#i18n 'upload.success.link'
}}go to the Explorer{{/i18n
}}</a>{{#i18n 'upload.success.end'
}}.{{/i18n}}
</p>
</div>
<div class="field form-feedback-bar has-background-danger has-text-white">
<p class="help">{{#i18n 'upload_failed_help'}}
<p class="help">{{#i18n 'upload.failed-help'}}
Uploading failed.
Please try again and if this error keeps occuring,
contact the site administrator.
Expand All @@ -19,25 +23,25 @@
</div>
<div class="field is-grouped">
<div class="control">
<button type=submit class="button is-link btn-submit">{{#i18n 'submit'}}Submit{{/i18n}}</button>
<button type=submit class="button is-link btn-submit">{{#i18n 'button.submit'}}Submit{{/i18n}}</button>
</div>
<div class="control">
<button type=button class="button is-link is-light btn-preview">{{#i18n 'preview'}}Preview{{/i18n}}</button>
<button type=button class="button is-link is-light btn-preview">{{#i18n 'button.preview'}}Preview{{/i18n}}</button>
</div>
<div class="control">
<button type=reset class="button is-link is-light btn-cancel">{{#i18n 'cancel'}}Cancel{{/i18n}}</button>
<button type=reset class="button is-link is-light btn-cancel">{{#i18n 'button.cancel'}}Cancel{{/i18n}}</button>
</div>
</div>
</div>
<div class="modal is-clipped">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">{{#i18n 'preview_source'}}Preview source content{{/i18n}}</p>
<p class="modal-card-title">{{#i18n 'upload.preview-title'}}Preview source content{{/i18n}}</p>
<button
type=button
class="delete"
aria-label="{{#i18n 'close'}}close{{/i18n}}"
aria-label="{{#i18n 'button.close'}}close{{/i18n}}"
>
<i class="fas fa-times"></i>
</button>
Expand Down

0 comments on commit 193f053

Please sign in to comment.