Bug 38201: Do not export $__ from the base resource

We had this following warning in the console:
[Vue warn]: setup() return property "$__" should not start with "$" or "_" which are reserved prefixes for Vue internals.

Trying to fix this and realized we could do better in our handling of
the i18n functions.

This patch suggests to:
1. Have "@k" available as the Koha Vue root path so that we can easily
   import without relative paths
   TODO - Should be applied to all other imports
2. Import the i18n functions from the components when we need it
3. Do not have them available in the i18n object exported by the
   base resource
4. Remove direct use of __() from scripts and always use $__()

(cherry picked from commit 247675939ef28a90d21be863c6a57382cf3de966)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-06-26 16:07:10 +02:00 committed by Lucas Gass
parent 79a3bf56f5
commit d80916696f
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
53 changed files with 487 additions and 527 deletions

View File

@ -8,6 +8,7 @@
import BaseResource from "../../BaseResource.vue";
import { useBaseResource } from "../../../composables/base-resource.js";
import { APIClient } from "../../../fetch/api-client.js";
import { $__ } from "@k/i18n";
export default {
props: {
@ -25,14 +26,14 @@ export default {
apiClient: APIClient.record_sources.record_sources,
resourceTableUrl: APIClient.record_sources.httpClient._baseURL,
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this record source?"
),
deleteSuccessMessage: __("Record source %s deleted"),
displayName: __("Record source"),
editLabel: __("Edit record source #%s"),
emptyListMessage: __("There are no record sources defined"),
newLabel: __("New record source"),
deleteSuccessMessage: $__("Record source %s deleted"),
displayName: $__("Record source"),
editLabel: $__("Edit record source #%s"),
emptyListMessage: $__("There are no record sources defined"),
newLabel: $__("New record source"),
},
props,
resourceAttrs: [
@ -40,9 +41,9 @@ export default {
name: "record_source_id",
required: true,
type: "text",
label: __("Id"),
label: $__("Id"),
tableColumnDefinition: {
title: __("ID"),
title: $__("ID"),
data: "record_source_id",
searchable: true,
},
@ -52,12 +53,12 @@ export default {
name: "name",
required: true,
type: "text",
label: __("Name"),
label: $__("Name"),
},
{
name: "can_be_edited",
type: "checkbox",
label: __("Can be edited"),
label: $__("Can be edited"),
value: false,
},
],
@ -71,7 +72,7 @@ export default {
"edit",
{
delete: {
text: __("Delete"),
text: $__("Delete"),
icon: "fa fa-trash",
should_display: row => row.usage_count == 0,
callback: baseResource.doResourceDelete,
@ -96,7 +97,7 @@ export default {
.then(
success => {
baseResource.setMessage(
baseResource.$__("Record source updated!")
$__("Record source updated!")
);
baseResource.router.push({
name: "RecordSourcesList",
@ -107,9 +108,7 @@ export default {
} else {
response = baseResource.apiClient.create(recordSource).then(
success => {
baseResource.setMessage(
baseResource.$__("Record source created!")
);
baseResource.setMessage($__("Record source created!"));
baseResource.router.push({ name: "RecordSourcesList" });
},
error => {}

View File

@ -11,7 +11,6 @@
:toolbarButtons="instancedResource.toolbarButtons"
component="list"
:resource="resource"
:i18n="instancedResource.i18n"
:componentPropData="componentPropData"
/>
</template>
@ -33,7 +32,6 @@
:toolbarButtons="instancedResource.toolbarButtons"
component="show"
:resource="resource"
:i18n="instancedResource.i18n"
:componentPropData="componentPropData"
/>
</template>
@ -48,7 +46,6 @@
:toolbarButtons="instancedResource.toolbarButtons"
component="form"
:resource="resource"
:i18n="instancedResource.i18n"
:componentPropData="componentPropData"
:sticky="
instancedResource.stickyToolbar &&

View File

@ -14,12 +14,13 @@
</template>
<script>
import { $__ } from "@k/i18n";
export default {
name: "ButtonSubmit",
props: {
title: {
type: String,
default: __("Submit"),
default: $__("Submit"),
required: false,
},
icon: {

View File

@ -10,6 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "@k/i18n";
export default {
props: {
@ -29,7 +30,7 @@ export default {
{
name: "by_expired",
type: "checkbox",
label: __("Filter by expired"),
label: $__("Filter by expired"),
value: false,
onChange: function (filters) {
if (filters.by_expired) {
@ -45,7 +46,7 @@ export default {
{
name: "max_expiration_date",
type: "date",
label: __("on"),
label: $__("on"),
componentProps: {
disabled: {
resourceProperty: "by_expired",
@ -57,7 +58,7 @@ export default {
{
name: "by_mine",
type: "checkbox",
label: __("Show mine only"),
label: $__("Show mine only"),
value: false,
},
];
@ -73,14 +74,14 @@ export default {
apiClient: APIClient.erm.agreements,
resourceTableUrl: APIClient.erm.httpClient._baseURL + "agreements",
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this agreement?"
),
deleteSuccessMessage: __("Agreement %s deleted"),
displayName: __("Agreement"),
editLabel: __("Edit agreement #%s"),
emptyListMessage: __("There are no agreements defined"),
newLabel: __("New agreement"),
deleteSuccessMessage: $__("Agreement %s deleted"),
displayName: $__("Agreement"),
editLabel: $__("Edit agreement #%s"),
emptyListMessage: $__("There are no agreements defined"),
newLabel: $__("New agreement"),
},
embedded: props.embedded,
addFiltersToList: true,
@ -88,7 +89,7 @@ export default {
resourceAttrs: [
{
name: "agreement_id",
label: __("ID"),
label: $__("ID"),
type: "text",
hideIn: ["Form", "Show"],
},
@ -96,12 +97,12 @@ export default {
name: "name",
required: true,
type: "text",
label: __("Agreement name"),
label: $__("Agreement name"),
},
{
name: "vendor_id",
type: "vendor",
label: __("Vendor"),
label: $__("Vendor"),
showElement: {
type: "text",
value: "vendor.name",
@ -114,13 +115,13 @@ export default {
{
name: "description",
type: "textarea",
label: __("Description"),
label: $__("Description"),
},
{
name: "status",
required: true,
type: "select",
label: __("Status"),
label: $__("Status"),
avCat: "av_agreement_statuses",
onSelected: resource => {
if (resource.status !== "closed") {
@ -132,26 +133,26 @@ export default {
{
name: "closure_reason",
type: "select",
label: __("Closure reason"),
label: $__("Closure reason"),
avCat: "av_agreement_closure_reasons",
disabled: agreement => agreement.status !== "closed",
},
{
name: "is_perpetual",
type: "boolean",
label: __("Is perpetual"),
label: $__("Is perpetual"),
},
{
name: "renewal_priority",
type: "select",
label: __("Renewal priority"),
label: $__("Renewal priority"),
avCat: "av_agreement_renewal_priorities",
},
{
name: "license_info",
type: "textarea",
textAreaRows: 2,
label: __("License info"),
label: $__("License info"),
hideIn: ["List"],
},
{
@ -163,35 +164,35 @@ export default {
hidden: agreement => !!agreement.periods?.length,
columns: [
{
name: __("Period start"),
name: $__("Period start"),
value: "started_on",
format: format_date,
},
{
name: __("Period end"),
name: $__("Period end"),
value: "ended_on",
format: format_date,
},
{
name: __("Cancellation deadline"),
name: $__("Cancellation deadline"),
value: "cancellation_deadline",
format: format_date,
},
{
name: __("Notes"),
name: $__("Notes"),
value: "notes",
},
],
},
group: __("Periods"),
group: $__("Periods"),
componentProps: {
resourceRelationships: {
resourceProperty: "periods",
},
relationshipStrings: {
nameLowerCase: __("period"),
nameUpperCase: __("Period"),
namePlural: __("periods"),
nameLowerCase: $__("period"),
nameUpperCase: $__("Period"),
namePlural: $__("periods"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -207,7 +208,7 @@ export default {
{
name: "started_on",
type: "date",
label: __("Start date"),
label: $__("Start date"),
required: true,
indexRequired: true,
componentProps: {
@ -225,14 +226,14 @@ export default {
{
name: "ended_on",
type: "date",
label: __("End date"),
label: $__("End date"),
required: false,
indexRequired: true,
},
{
name: "cancellation_deadline",
type: "date",
label: __("Cancellation deadline"),
label: $__("Cancellation deadline"),
required: false,
indexRequired: true,
},
@ -240,7 +241,7 @@ export default {
name: "notes",
required: false,
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
],
@ -249,19 +250,19 @@ export default {
{
name: "user_roles",
type: "relationshipWidget",
group: __("Users"),
group: $__("Users"),
showElement: {
type: "table",
columnData: "user_roles",
hidden: agreement => !!agreement.user_roles?.length,
columns: [
{
name: __("Name"),
name: $__("Name"),
value: "patron",
format: patron_to_html,
},
{
name: __("Role"),
name: $__("Role"),
value: "role",
av: "av_user_roles",
},
@ -272,9 +273,9 @@ export default {
resourceProperty: "user_roles",
},
relationshipStrings: {
nameLowerCase: __("user"),
nameUpperCase: __("Agreement user"),
namePlural: __("users"),
nameLowerCase: $__("user"),
nameUpperCase: $__("Agreement user"),
namePlural: $__("users"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -289,7 +290,7 @@ export default {
{
name: "user_id",
type: "component",
label: __("User"),
label: $__("User"),
componentPath: "./PatronSearch.vue",
required: true,
indexRequired: true,
@ -308,14 +309,14 @@ export default {
},
label: {
type: "string",
value: __("User"),
value: $__("User"),
},
},
},
{
name: "role",
type: "select",
label: __("Role"),
label: $__("Role"),
avCat: "av_user_roles",
required: true,
indexRequired: true,
@ -326,7 +327,7 @@ export default {
{
name: "agreement_licenses",
type: "relationshipWidget",
group: __("Licenses"),
group: $__("Licenses"),
showElement: {
type: "table",
columnData: "agreement_licenses",
@ -334,7 +335,7 @@ export default {
!!agreement.agreement_licenses?.length,
columns: [
{
name: __("Name"),
name: $__("Name"),
value: "license.name",
link: {
name: "LicensesShow",
@ -344,21 +345,21 @@ export default {
},
},
{
name: __("Status"),
name: $__("Status"),
value: "status",
av: "av_agreement_license_statuses",
},
{
name: __("Physical location"),
name: $__("Physical location"),
value: "physical_location",
av: "av_agreement_license_location",
},
{
name: __("Notes"),
name: $__("Notes"),
value: "notes",
},
{
name: __("URI"),
name: $__("URI"),
value: "uri",
},
],
@ -380,16 +381,16 @@ export default {
resourceProperty: "agreement_licenses",
},
relationshipStrings: {
nameLowerCase: __("license"),
nameUpperCase: __("License"),
namePlural: __("licenses"),
nameLowerCase: $__("license"),
nameUpperCase: $__("License"),
namePlural: $__("licenses"),
},
},
relationshipFields: [
{
name: "license_id",
type: "component",
label: __("License"),
label: $__("License"),
componentPath: "./InfiniteScrollSelect.vue",
required: true,
indexRequired: true,
@ -423,14 +424,14 @@ export default {
{
name: "status",
type: "select",
label: __("Status"),
label: $__("Status"),
avCat: "av_agreement_license_statuses",
indexRequired: true,
},
{
name: "physical_location",
type: "select",
label: __("Physical location"),
label: $__("Physical location"),
avCat: "av_agreement_license_location",
indexRequired: true,
},
@ -438,14 +439,14 @@ export default {
name: "notes",
required: false,
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
{
name: "uri",
required: false,
type: "text",
label: __("URI"),
label: $__("URI"),
indexRequired: true,
},
],
@ -454,7 +455,7 @@ export default {
{
name: "agreement_relationships",
type: "relationshipWidget",
group: __("Related agreements"),
group: $__("Related agreements"),
showElement: {
type: "component",
hidden: agreement =>
@ -482,9 +483,9 @@ export default {
resourceProperty: "agreement_relationships",
},
relationshipStrings: {
nameLowerCase: __("related agreement"),
nameUpperCase: __("Related agreement"),
namePlural: __("related agreements"),
nameLowerCase: $__("related agreement"),
nameUpperCase: $__("Related agreement"),
namePlural: $__("related agreements"),
},
filters: {
type: "filter",
@ -504,7 +505,7 @@ export default {
{
name: "related_agreement_id",
type: "select",
label: __("Related agreement"),
label: $__("Related agreement"),
requiredKey: "agreement_id",
selectLabel: "name",
required: true,
@ -513,7 +514,7 @@ export default {
{
name: "relationship",
type: "select",
label: __("Relationship"),
label: $__("Relationship"),
avCat: "av_agreement_relationships",
required: true,
indexRequired: true,
@ -522,7 +523,7 @@ export default {
name: "notes",
required: false,
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
],
@ -549,10 +550,10 @@ export default {
{
name: "documents",
type: "relationshipWidget",
group: __("Documents"),
group: $__("Documents"),
showElement: {
type: "component",
label: __("Agreement users"),
label: $__("Agreement users"),
hidden: agreement => !!agreement.documents?.length,
componentPath: "./DocumentDisplay.vue",
componentProps: {
@ -567,9 +568,9 @@ export default {
resourceProperty: "documents",
},
relationshipStrings: {
nameLowerCase: __("document"),
nameUpperCase: __("Document"),
namePlural: __("documents"),
nameLowerCase: $__("document"),
nameUpperCase: $__("Document"),
namePlural: $__("documents"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -589,7 +590,7 @@ export default {
name: "document",
type: "component",
componentPath: "./DocumentSelect.vue",
label: __("File"),
label: $__("File"),
componentProps: {
counter: {
type: "string",
@ -606,21 +607,21 @@ export default {
name: "physical_location",
required: false,
type: "text",
label: __("Physical location"),
label: $__("Physical location"),
indexRequired: true,
},
{
name: "uri",
required: false,
type: "text",
label: __("URI"),
label: $__("URI"),
indexRequired: true,
},
{
name: "notes",
required: false,
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
],
@ -659,8 +660,8 @@ export default {
"av_agreement_closure_reasons"
),
6: [
{ _id: 0, _str: __("No") },
{ _id: 1, _str: __("Yes") },
{ _id: 0, _str: $__("No") },
{ _id: 1, _str: $__("Yes") },
],
7: () =>
baseResource.map_av_dt_filter(
@ -674,7 +675,7 @@ export default {
? [
{
select: {
text: __("Select"),
text: $__("Select"),
icon: "fa fa-check",
},
},
@ -702,9 +703,7 @@ export default {
);
if (duplicate_license_ids.length) {
errors.push(
baseResource.$__("A license is used several times")
);
errors.push($__("A license is used several times"));
}
const related_agreement_ids = agreement.agreement_relationships.map(
@ -717,9 +716,7 @@ export default {
if (duplicate_related_agreement_ids.length) {
errors.push(
baseResource.$__(
"An agreement is used as relationship several times"
)
$__("An agreement is used as relationship several times")
);
}
@ -727,9 +724,7 @@ export default {
agreement_licenses.filter(al => al.status == "controlling")
.length > 1
) {
errors.push(
baseResource.$__("Only one controlling license is allowed")
);
errors.push($__("Only one controlling license is allowed"));
}
let documents_with_uploaded_files = agreement.documents.filter(
@ -741,17 +736,15 @@ export default {
).length >= 1
) {
errors.push(
baseResource
.$__("File size exceeds maximum allowed: %s MB")
.format((max_allowed_packet / (1024 * 1024)).toFixed(2))
$__("File size exceeds maximum allowed: %s MB").format(
(max_allowed_packet / (1024 * 1024)).toFixed(2)
)
);
}
agreement.user_roles.forEach((user, i) => {
if (user.patron_str === "") {
errors.push(
baseResource
.$__("Agreement user %s is missing a user")
.format(i + 1)
$__("Agreement user %s is missing a user").format(i + 1)
);
}
});
@ -809,9 +802,7 @@ export default {
if (agreement_id) {
baseResource.apiClient.update(agreement, agreement_id).then(
success => {
baseResource.setMessage(
baseResource.$__("Agreement updated")
);
baseResource.setMessage($__("Agreement updated"));
baseResource.router.push({ name: "AgreementsList" });
},
error => {}
@ -819,9 +810,7 @@ export default {
} else {
baseResource.apiClient.create(agreement).then(
success => {
baseResource.setMessage(
baseResource.$__("Agreement created")
);
baseResource.setMessage($__("Agreement created"));
baseResource.router.push({ name: "AgreementsList" });
},
error => {}

View File

@ -72,7 +72,7 @@
import AgreementResource from "./AgreementResource.vue";
import { APIClient } from "../../fetch/api-client.js";
import { setWarning, removeMessages } from "../../messages";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup(props, { emit }) {

View File

@ -3,6 +3,7 @@
<div id="filters">
<a href="#" @click.prevent="toggleFilters($event)"
><i class="fa fa-search"></i>
{{ displayFilters ? $__("Hide filters") : $__("Show filters") }}
</a>
<fieldset v-if="displayFilters">
@ -62,6 +63,7 @@ import { inject, ref, reactive, useTemplateRef } from "vue";
import { storeToRefs } from "pinia";
import KohaTable from "../KohaTable.vue";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup(props) {
@ -101,7 +103,7 @@ export default {
return [
{
title: __("Name"),
title: $__("Name"),
data: "title.publication_title",
searchable: false,
orderable: false,
@ -116,14 +118,14 @@ export default {
node +=
" " +
'<i class="fa fa-check-square" style="color: green; float: right;" title="' +
__("Is selected") +
$__("Is selected") +
'" />';
}
return node;
},
},
{
title: __("Publication type"),
title: $__("Publication type"),
data: "title.publication_type",
searchable: false,
orderable: false,

View File

@ -71,6 +71,7 @@ import { APIClient } from "../../fetch/api-client.js";
import { build_url_params, build_url } from "../../composables/datatables";
import KohaTable from "../KohaTable.vue";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {
@ -99,7 +100,7 @@ export default {
return [
{
title: __("Name"),
title: $__("Name"),
data: "me.package_id:me.name",
searchable: false,
orderable: false,
@ -114,14 +115,14 @@ export default {
node +=
" " +
'<i class="fa fa-check-square" style="color: green; float: right;" title="' +
__("Is selected") +
$__("Is selected") +
'" />';
}
return node;
},
},
{
title: __("Vendor"),
title: $__("Vendor"),
data: "vendor_id",
searchable: false,
orderable: false,
@ -130,7 +131,7 @@ export default {
},
},
{
title: __("Type"),
title: $__("Type"),
data: "package_type",
searchable: false,
orderable: false,
@ -144,7 +145,7 @@ export default {
},
},
{
title: __("Content type"),
title: $__("Content type"),
searchable: false,
orderable: false,
render: function (data, type, row, meta) {

View File

@ -44,6 +44,7 @@
import { createVNode, onMounted, ref, render } from "vue";
import { useDataTable } from "../../composables/datatables";
import { useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup(props) {
@ -92,7 +93,7 @@ export default {
],
columns: [
{
title: __("Name"),
title: $__("Name"),
data: "package.name",
searchable: false,
orderable: false,
@ -140,7 +141,7 @@ export default {
color: "green",
float: "right",
},
title: __("Is selected"),
title: $__("Is selected"),
}),
]);
}

View File

@ -75,6 +75,7 @@ import { APIClient } from "../../fetch/api-client.js";
import { build_url_params, build_url } from "../../composables/datatables";
import KohaTable from "../KohaTable.vue";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {
@ -103,7 +104,7 @@ export default {
let escape_str = escape_str;
return [
{
title: __("Title"),
title: $__("Title"),
data: "me.publication_title",
searchable: false,
orderable: false,
@ -120,14 +121,14 @@ export default {
node +=
" " +
'<i class="fa fa-check-square" style="color: green; float: right;" title="' +
__("Is selected") +
$__("Is selected") +
'" />';
}
return node;
},
},
{
title: __("Publisher name"),
title: $__("Publisher name"),
data: "me.publisher_name",
searchable: false,
orderable: false,
@ -136,7 +137,7 @@ export default {
},
},
{
title: __("Publication type"),
title: $__("Publication type"),
data: "publication_type",
searchable: false,
orderable: false,
@ -150,7 +151,7 @@ export default {
},
},
{
title: __("Identifier"),
title: $__("Identifier"),
data: "print_identifier:online_identifier",
searchable: false,
orderable: false,
@ -160,14 +161,14 @@ export default {
return (
(print_identifier
? escape_str(
__("ISBN (Print): %s").format(
$__("ISBN (Print): %s").format(
print_identifier
)
)
: "") +
(online_identifier
? escape_str(
__("ISBN (Online): %s").format(
$__("ISBN (Online): %s").format(
online_identifier
)
)

View File

@ -10,6 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "@k/i18n";
export default {
props: {
@ -34,14 +35,14 @@ export default {
resourceTableUrl:
APIClient.erm.httpClient._baseURL + "eholdings/local/packages",
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this local package?"
),
deleteSuccessMessage: __("Local package %s deleted"),
displayName: __("Local package"),
editLabel: __("Edit package #%s"),
emptyListMessage: __("There are no packages defined"),
newLabel: __("New package"),
deleteSuccessMessage: $__("Local package %s deleted"),
displayName: $__("Local package"),
editLabel: $__("Edit package #%s"),
emptyListMessage: $__("There are no packages defined"),
newLabel: $__("New package"),
},
extendedAttributesResourceType: "package",
eholdings_packages_table_settings,
@ -53,9 +54,9 @@ export default {
name: "name",
required: true,
type: "text",
label: __("Package name"),
label: $__("Package name"),
tableColumnDefinition: {
title: __("Package name"),
title: $__("Package name"),
data: "name:package_id",
searchable: true,
orderable: true,
@ -73,7 +74,7 @@ export default {
{
name: "vendor_id",
type: "vendor",
label: __("Vendor"),
label: $__("Vendor"),
showElement: {
type: "text",
value: "vendor.name",
@ -86,19 +87,19 @@ export default {
{
name: "package_type",
type: "select",
label: __("Type"),
label: $__("Type"),
avCat: "av_package_types",
},
{
name: "content_type",
type: "select",
label: __("Content type"),
label: $__("Content type"),
avCat: "av_package_content_types",
},
{
name: "created_on",
type: "date",
label: __("Created on"),
label: $__("Created on"),
showElement: {
type: "text",
value: "created_on",
@ -110,12 +111,12 @@ export default {
name: "notes",
required: false,
type: "text",
label: __("Notes"),
label: $__("Notes"),
},
{
name: "package_agreements",
type: "relationshipWidget",
group: __("Agreements"),
group: $__("Agreements"),
showElement: {
type: "table",
columnData: "package_agreements",
@ -123,7 +124,7 @@ export default {
!!erm_package.package_agreements?.length,
columns: [
{
name: __("Agreement name"),
name: $__("Agreement name"),
value: "agreement.name",
link: {
name: "AgreementsShow",
@ -146,9 +147,9 @@ export default {
resourceProperty: "package_agreements",
},
relationshipStrings: {
nameLowerCase: __("agreement"),
nameUpperCase: __("Agreement"),
namePlural: __("agreements"),
nameLowerCase: $__("agreement"),
nameUpperCase: $__("Agreement"),
namePlural: $__("agreements"),
},
fetchOptions: {
type: "boolean",
@ -159,7 +160,7 @@ export default {
{
name: "agreement_id",
type: "select",
label: __("Agreement"),
label: $__("Agreement"),
requiredKey: "agreement_id",
selectLabel: "name",
required: true,
@ -214,9 +215,7 @@ export default {
);
if (duplicate_agreement_ids.length) {
errors.push(
baseResource.$__("An agreement is used several times")
);
errors.push($__("An agreement is used several times"));
}
baseResource.setWarning(errors.join("<br>"));
@ -247,9 +246,7 @@ export default {
if (package_id) {
baseResource.apiClient.update(erm_package, package_id).then(
success => {
baseResource.setMessage(
baseResource.$__("Package updated")
);
baseResource.setMessage($__("Package updated"));
baseResource.router.push({
name: "EHoldingsLocalPackagesList",
});
@ -259,9 +256,7 @@ export default {
} else {
baseResource.apiClient.create(erm_package).then(
success => {
baseResource.setMessage(
baseResource.$__("Package created")
);
baseResource.setMessage($__("Package created"));
baseResource.router.push({
name: "EHoldingsLocalPackagesList",
});
@ -275,7 +270,7 @@ export default {
return [
{
type: "component",
name: baseResource.$__("Titles"),
name: $__("Titles"),
hidden: erm_package => erm_package,
componentPath: "./RelationshipTableDisplay.vue",
componentProps: {
@ -284,7 +279,7 @@ export default {
value: {
columns: [
{
title: baseResource.$__("Name"),
title: $__("Name"),
data: "title.publication_title",
searchable: true,
orderable: true,
@ -306,9 +301,7 @@ export default {
},
},
{
title: baseResource.$__(
"Publication type"
),
title: $__("Publication type"),
data: "title.publication_type",
searchable: true,
orderable: true,

View File

@ -8,6 +8,7 @@
import { createVNode, onMounted, render } from "vue";
import { useDataTable } from "../../composables/datatables";
import { useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup(props) {
@ -33,7 +34,7 @@ export default {
order: [[0, "asc"]],
columns: [
{
title: __("Name"),
title: $__("Name"),
data: "package.name",
searchable: true,
orderable: true,

View File

@ -10,6 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "@k/i18n";
export default {
props: {
@ -26,12 +27,12 @@ export default {
{
to: { name: "EHoldingsLocalTitlesFormImport" },
icon: "plus",
title: baseResource.$__("Import from list"),
title: $__("Import from list"),
},
{
to: { name: "EHoldingsLocalTitlesKBARTImport" },
icon: "plus",
title: baseResource.$__("Import from KBART file"),
title: $__("Import from KBART file"),
},
],
};
@ -49,14 +50,14 @@ export default {
resourceTableUrl:
APIClient.erm.httpClient._baseURL + "eholdings/local/titles",
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this title?"
),
deleteSuccessMessage: __("Title %s deleted"),
displayName: __("Title"),
editLabel: __("Edit title #%s"),
emptyListMessage: __("There are no titles defined"),
newLabel: __("New title"),
deleteSuccessMessage: $__("Title %s deleted"),
displayName: $__("Title"),
editLabel: $__("Edit title #%s"),
emptyListMessage: $__("There are no titles defined"),
newLabel: $__("New title"),
},
eholdings_titles_table_settings,
vendors,
@ -68,9 +69,9 @@ export default {
name: "publication_title",
required: true,
type: "text",
label: __("Publication title"),
label: $__("Publication title"),
tableColumnDefinition: {
title: __("Publication title"),
title: $__("Publication title"),
data: "publication_title:title_id",
searchable: true,
orderable: true,
@ -88,9 +89,9 @@ export default {
{
name: "print_identifier",
type: "text",
label: __("Print-format identifier"),
label: $__("Print-format identifier"),
tableColumnDefinition: {
title: __("Identifier"),
title: $__("Identifier"),
data: "print_identifier:online_identifier",
searchable: true,
orderable: true,
@ -100,14 +101,14 @@ export default {
return [
print_identifier
? escape_str(
__("ISBN (Print): %s").format(
$__("ISBN (Print): %s").format(
print_identifier
)
)
: "",
online_identifier
? escape_str(
__("ISBN (Online): %s").format(
$__("ISBN (Online): %s").format(
online_identifier
)
)
@ -119,57 +120,57 @@ export default {
{
name: "online_identifier",
type: "text",
label: __("Online-format identifier"),
label: $__("Online-format identifier"),
hideIn: ["List"],
},
{
name: "date_first_issue_online",
type: "text",
label: __("Date of first serial issue available online"),
label: $__("Date of first serial issue available online"),
hideIn: ["List"],
},
{
name: "num_first_vol_online",
type: "text",
label: __("Number of first volume available online"),
label: $__("Number of first volume available online"),
hideIn: ["List"],
},
{
name: "num_first_issue_online",
type: "text",
label: __("Number of first issue available online"),
label: $__("Number of first issue available online"),
hideIn: ["List"],
},
{
name: "date_last_issue_online",
type: "text",
label: __("Date of last issue available online"),
label: $__("Date of last issue available online"),
hideIn: ["List"],
},
{
name: "num_last_vol_online",
type: "text",
label: __("Number of last volume available online"),
label: $__("Number of last volume available online"),
hideIn: ["List"],
},
{
name: "num_last_issue_online",
type: "text",
label: __("Number of last issue available online"),
label: $__("Number of last issue available online"),
hideIn: ["List"],
},
{
name: "title_url",
type: "text",
label: __("Title-level URL"),
label: $__("Title-level URL"),
hideIn: ["List"],
},
{
name: "first_author",
type: "text",
label: __("First author"),
label: $__("First author"),
tableColumnDefinition: {
title: __("Contributors"),
title: $__("Contributors"),
data: "first_author:first_editor",
searchable: true,
orderable: true,
@ -187,73 +188,75 @@ export default {
{
name: "embargo_info",
type: "text",
label: __("Embargo information"),
label: $__("Embargo information"),
hideIn: ["List"],
},
{
name: "coverage_depth",
type: "text",
label: __("Coverage depth"),
label: $__("Coverage depth"),
hideIn: ["List"],
},
{
name: "notes",
type: "text",
label: __("Notes"),
label: $__("Notes"),
hideIn: ["List"],
},
{
name: "publisher_name",
type: "text",
label: __("Publisher name"),
label: $__("Publisher name"),
hideIn: ["List"],
},
{
name: "publication_type",
type: "select",
label: __("Publication type"),
label: $__("Publication type"),
avCat: "av_title_publication_types",
},
{
name: "date_monograph_published_print",
type: "text",
label: __("Date the monograph is first published in print"),
label: $__(
"Date the monograph is first published in print"
),
hideIn: ["List"],
},
{
name: "date_monograph_published_online",
type: "text",
label: __("Date the monograph is first published online"),
label: $__("Date the monograph is first published online"),
hideIn: ["List"],
},
{
name: "monograph_volume",
type: "text",
label: __("Number of volume for monograph"),
label: $__("Number of volume for monograph"),
hideIn: ["List"],
},
{
name: "monograph_edition",
type: "text",
label: __("Edition of the monograph"),
label: $__("Edition of the monograph"),
hideIn: ["List"],
},
{
name: "first_editor",
type: "text",
label: __("First editor"),
label: $__("First editor"),
hideIn: ["List"],
},
{
name: "parent_publication_title_id",
type: "text",
label: __("Title identifier of the parent publication"),
label: $__("Title identifier of the parent publication"),
hideIn: ["List"],
},
{
name: "preceding_publication_title_id",
type: "text",
label: __(
label: $__(
"Title identifier of any preceding publication title"
),
hideIn: ["List"],
@ -261,7 +264,7 @@ export default {
{
name: "access_type",
type: "text",
label: __("Access type"),
label: $__("Access type"),
hideIn: ["List"],
},
{
@ -269,19 +272,19 @@ export default {
type: "checkbox",
group:
props.routeAction === "add"
? __("Create linked bibliographic record")
: __("Update linked bibliographic record"),
? $__("Create linked bibliographic record")
: $__("Update linked bibliographic record"),
label:
props.routeAction === "add"
? __("Create bibliographic record")
: __("Update bibliographic record"),
? $__("Create bibliographic record")
: $__("Update bibliographic record"),
value: false,
hideIn: ["List"],
},
{
name: "resources",
type: "relationshipWidget",
group: __("Packages"),
group: $__("Packages"),
apiClient: APIClient.erm.localPackages,
showElement: {
type: "component",
@ -293,7 +296,7 @@ export default {
value: {
columns: [
{
title: __("Name"),
title: $__("Name"),
data: "package.name",
searchable: true,
orderable: true,
@ -365,9 +368,9 @@ export default {
resourceProperty: "resources",
},
relationshipStrings: {
nameLowerCase: __("package"),
nameUpperCase: __("Package"),
namePlural: __("packages"),
nameLowerCase: $__("package"),
nameUpperCase: $__("Package"),
namePlural: $__("packages"),
},
fetchOptions: {
type: "boolean",
@ -378,7 +381,7 @@ export default {
{
name: "package_id",
type: "select",
label: __("Package"),
label: $__("Package"),
requiredKey: "package_id",
selectLabel: "name",
required: true,
@ -387,7 +390,7 @@ export default {
{
name: "vendor_id",
type: "vendor",
label: __("Vendor"),
label: $__("Vendor"),
indexRequired: true,
showElement: {
type: "text",
@ -403,7 +406,7 @@ export default {
{
name: "started_on",
type: "date",
label: __("Start date"),
label: $__("Start date"),
componentProps: {
date_to: {
type: "string",
@ -415,12 +418,12 @@ export default {
{
name: "ended_on",
type: "date",
label: __("End date"),
label: $__("End date"),
},
{
name: "proxy",
type: "text",
label: __("Proxy"),
label: $__("Proxy"),
},
],
hideIn: ["List"],
@ -462,9 +465,7 @@ export default {
);
if (duplicate_package_ids.length) {
errors.push(
baseResource.$__("A package is used several times")
);
errors.push($__("A package is used several times"));
}
baseResource.setWarning(errors.join("<br>"));
@ -492,9 +493,7 @@ export default {
if (title_id) {
baseResource.apiClient.update(title, title_id).then(
success => {
baseResource.setMessage(
baseResource.$__("Title updated")
);
baseResource.setMessage($__("Title updated"));
baseResource.router.push({
name: "EHoldingsLocalTitlesList",
});
@ -504,9 +503,7 @@ export default {
} else {
baseResource.apiClient.create(title).then(
success => {
baseResource.setMessage(
baseResource.$__("Title created")
);
baseResource.setMessage($__("Title created"));
baseResource.router.push({
name: "EHoldingsLocalTitlesList",
});

View File

@ -30,7 +30,7 @@ import { setError } from "../../messages";
import { createVNode, onBeforeMount, onMounted, ref, render } from "vue";
import { APIClient } from "../../fetch/api-client.js";
import { useDataTable } from "../../composables/datatables";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {
@ -67,7 +67,7 @@ export default {
order: [[0, "asc"]],
columns: [
{
title: __("Name"),
title: $__("Name"),
data: "shelfname",
searchable: true,
orderable: true,
@ -79,7 +79,7 @@ export default {
},
},
{
title: __("Actions"),
title: $__("Actions"),
data: function (row, type, val, meta) {
return '<div class="actions"></div>';
},
@ -108,7 +108,7 @@ export default {
class: "fa fa-download",
"aria-hidden": "true",
}),
__("Import"),
$__("Import"),
]
);

View File

@ -68,7 +68,7 @@
import ButtonSubmit from "../ButtonSubmit.vue";
import { APIClient } from "../../fetch/api-client.js";
import { ref, inject, useTemplateRef, onBeforeMount } from "vue";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -10,6 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "@k/i18n";
export default {
props: {
@ -35,14 +36,14 @@ export default {
apiClient: APIClient.erm.licenses,
resourceTableUrl: APIClient.erm.httpClient._baseURL + "licenses",
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this license?"
),
deleteSuccessMessage: __("License %s deleted"),
displayName: __("License"),
editLabel: __("Edit license #%s"),
emptyListMessage: __("There are no licenses defined"),
newLabel: __("New license"),
deleteSuccessMessage: $__("License %s deleted"),
displayName: $__("License"),
editLabel: $__("Edit license #%s"),
emptyListMessage: $__("There are no licenses defined"),
newLabel: $__("New license"),
},
extendedAttributesResourceType,
license_table_settings,
@ -52,7 +53,7 @@ export default {
resourceAttrs: [
{
name: "license_id",
label: __("ID"),
label: $__("ID"),
type: "text",
hideIn: ["Form", "Show"],
},
@ -60,12 +61,12 @@ export default {
name: "name",
required: true,
type: "text",
label: __("License name"),
label: $__("License name"),
},
{
name: "vendor_id",
type: "vendor",
label: __("Vendor"),
label: $__("Vendor"),
showElement: {
type: "text",
value: "vendor.name",
@ -78,27 +79,27 @@ export default {
{
name: "description",
type: "textarea",
label: __("Description"),
label: $__("Description"),
required: true,
},
{
name: "type",
required: true,
type: "select",
label: __("Type"),
label: $__("Type"),
avCat: "av_license_types",
},
{
name: "status",
required: true,
type: "select",
label: __("Status"),
label: $__("Status"),
avCat: "av_license_statuses",
},
{
name: "started_on",
type: "date",
label: __("Start date"),
label: $__("Start date"),
showElement: {
type: "text",
value: "started_on",
@ -114,7 +115,7 @@ export default {
{
name: "ended_on",
type: "date",
label: __("End date"),
label: $__("End date"),
showElement: {
type: "text",
value: "ended_on",
@ -124,20 +125,20 @@ export default {
{
name: "user_roles",
type: "relationshipWidget",
group: __("Users"),
group: $__("Users"),
showElement: {
type: "table",
columnData: "user_roles",
hidden: license => !!license.user_roles?.length,
label: __("License users"),
label: $__("License users"),
columns: [
{
name: __("Name"),
name: $__("Name"),
value: "patron",
format: patron_to_html,
},
{
name: __("Role"),
name: $__("Role"),
value: "role",
av: "av_user_roles",
},
@ -148,9 +149,9 @@ export default {
resourceProperty: "user_roles",
},
relationshipStrings: {
nameLowerCase: __("user"),
nameUpperCase: __("License user"),
namePlural: __("users"),
nameLowerCase: $__("user"),
nameUpperCase: $__("License user"),
namePlural: $__("users"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -165,7 +166,7 @@ export default {
{
name: "user_id",
type: "component",
label: __("User"),
label: $__("User"),
componentPath: "./PatronSearch.vue",
required: true,
indexRequired: true,
@ -184,14 +185,14 @@ export default {
},
label: {
type: "string",
value: __("User"),
value: $__("User"),
},
},
},
{
name: "role",
type: "select",
label: __("Role"),
label: $__("Role"),
avCat: "av_user_roles",
required: true,
indexRequired: true,
@ -202,7 +203,7 @@ export default {
{
name: "documents",
type: "relationshipWidget",
group: __("Documents"),
group: $__("Documents"),
showElement: {
type: "component",
hidden: license => !!license.documents?.length,
@ -219,9 +220,9 @@ export default {
resourceProperty: "documents",
},
relationshipStrings: {
nameLowerCase: __("document"),
nameUpperCase: __("Document"),
namePlural: __("documents"),
nameLowerCase: $__("document"),
nameUpperCase: $__("Document"),
namePlural: $__("documents"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -241,7 +242,7 @@ export default {
name: "document",
type: "component",
componentPath: "./DocumentSelect.vue",
label: __("File"),
label: $__("File"),
componentProps: {
counter: {
type: "string",
@ -258,21 +259,21 @@ export default {
name: "physical_location",
required: false,
type: "text",
label: __("Physical location"),
label: $__("Physical location"),
indexRequired: true,
},
{
name: "uri",
required: false,
type: "text",
label: __("URI"),
label: $__("URI"),
indexRequired: true,
},
{
name: "notes",
required: false,
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
],
@ -316,17 +317,15 @@ export default {
).length >= 1
) {
errors.push(
baseResource
.$__("File size exceeds maximum allowed: %s MB")
.format((max_allowed_packet / (1024 * 1024)).toFixed(2))
$__("File size exceeds maximum allowed: %s MB").format(
(max_allowed_packet / (1024 * 1024)).toFixed(2)
)
);
}
license.user_roles.forEach((user, i) => {
if (user.patron_str === "") {
errors.push(
baseResource
.$__("License user %s is missing a user")
.format(i + 1)
$__("License user %s is missing a user").format(i + 1)
);
}
});
@ -362,9 +361,7 @@ export default {
if (license_id) {
baseResource.apiClient.update(license, license_id).then(
success => {
baseResource.setMessage(
baseResource.$__("License updated")
);
baseResource.setMessage($__("License updated"));
baseResource.router.push({ name: "LicensesList" });
},
error => {}
@ -372,9 +369,7 @@ export default {
} else {
baseResource.apiClient.create(license).then(
success => {
baseResource.setMessage(
baseResource.$__("License created")
);
baseResource.setMessage($__("License created"));
baseResource.router.push({ name: "LicensesList" });
},
error => {}

View File

@ -36,7 +36,7 @@ import Dialog from "../Dialog.vue";
import { APIClient } from "../../fetch/api-client.js";
import "vue-select/dist/vue-select.css";
import { storeToRefs } from "pinia";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -19,8 +19,8 @@
import { APIClient } from "../../fetch/api-client.js";
import { inject, onMounted, ref, useTemplateRef } from "vue";
import KohaTable from "../KohaTable.vue";
import { $__ } from "../../i18n";
import { useRoute } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {
@ -72,14 +72,14 @@ export default {
const getTableColumns = () => {
return [
{
title: __("Filename"),
title: $__("Filename"),
data: "filename",
searchable: true,
orderable: true,
},
{
data: "importdate",
title: __("Import date"),
title: $__("Import date"),
render: function (data, type, row, meta) {
const date = row.importdate.substr(0, 10);
const time = row.importdate.substr(11, 8);
@ -89,7 +89,7 @@ export default {
orderable: true,
},
{
title: __("Imported by"),
title: $__("Imported by"),
render: function (data, type, row, meta) {
const { patron } = row;
const importer = patron

View File

@ -38,8 +38,8 @@
import { inject, onBeforeMount, ref } from "vue";
import ButtonSubmit from "../ButtonSubmit.vue";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "../../i18n";
import { useRoute } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -389,8 +389,8 @@ import { setMessage, setWarning } from "../../messages";
import { APIClient } from "../../fetch/api-client.js";
import { inject, onBeforeMount, ref } from "vue";
import { storeToRefs } from "pinia";
import { $__ } from "../../i18n";
import { useRouter, useRoute } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -40,7 +40,7 @@ import { inject, ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { APIClient } from "../../fetch/api-client.js";
import KohaTable from "../KohaTable.vue";
import { $__ } from "../../i18n/";
import { $__ } from "@k/i18n/";
export default {
setup() {
@ -55,7 +55,7 @@ export default {
const getTableColumns = () => {
return [
{
title: __("Name"),
title: $__("Name"),
data: "me.erm_usage_data_provider_id:me.name",
searchable: true,
orderable: true,
@ -70,13 +70,13 @@ export default {
},
},
{
title: __("Description"),
title: $__("Description"),
data: "description",
searchable: true,
orderable: true,
},
{
title: __("Status"),
title: $__("Status"),
data: "active",
render: function (data, type, row, meta) {
const status = row.active
@ -88,7 +88,7 @@ export default {
orderable: true,
},
{
title: __("Last run"),
title: $__("Last run"),
data: "last_run",
searchable: false,
orderable: false,

View File

@ -125,8 +125,8 @@ import UsageStatisticsDataProvidersFileImport from "./UsageStatisticsDataProvide
import UsageStatisticsDataProvidersCounterLogs from "./UsageStatisticsDataProvidersCounterLogs.vue";
import UsageStatisticsDataProviderDetails from "./UsageStatisticsDataProviderDetails.vue";
import UsageStatisticsProviderDataList from "./UsageStatisticsProviderDataList.vue";
import { $__ } from "../../i18n";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n/";
export default {
setup() {

View File

@ -27,7 +27,7 @@
import { inject, onMounted, ref, useTemplateRef, watch } from "vue";
import { APIClient } from "../../fetch/api-client.js";
import KohaTable from "../KohaTable.vue";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n/";
export default {
setup() {
@ -49,7 +49,7 @@ export default {
const getTableColumns = () => {
const columns = [
{
title: __("Provider"),
title: $__("Provider"),
data: "me.erm_usage_data_provider_id:me.name",
searchable: true,
orderable: true,
@ -63,26 +63,26 @@ export default {
data_types.forEach(data_type => {
columns.push(
{
title: __("Start"),
title: $__("Start"),
data: "description",
searchable: true,
orderable: true,
render: function (data, type, row, meta) {
const date = row[`earliest_${data_type}`]
? row[`earliest_${data_type}`]
: __("N/A");
: $__("N/A");
return date;
},
},
{
title: __("End"),
title: $__("End"),
data: "description",
searchable: true,
orderable: true,
render: function (data, type, row, meta) {
const date = row[`latest_${data_type}`]
? row[`latest_${data_type}`]
: __("N/A");
: $__("N/A");
return date;
},
}

View File

@ -19,6 +19,7 @@ import { APIClient } from "../../fetch/api-client.js";
import { onMounted, ref } from "vue";
import KohaTable from "../KohaTable.vue";
import { useRoute } from "vue-router";
import { $__ } from "@k/i18n/";
export default {
setup(props) {
@ -48,7 +49,7 @@ export default {
{
used_by: ["item", "database", "platforms"],
column: {
title: __("Platform"),
title: $__("Platform"),
data: "platform",
searchable: true,
orderable: true,
@ -57,7 +58,7 @@ export default {
{
used_by: ["title", "item", "database"],
column: {
title: __("Publisher"),
title: $__("Publisher"),
data: "publisher",
searchable: true,
orderable: true,
@ -66,7 +67,7 @@ export default {
{
used_by: ["title", "database"],
column: {
title: __("Publisher ID"),
title: $__("Publisher ID"),
data: "publisher_id",
searchable: true,
orderable: true,
@ -75,7 +76,7 @@ export default {
{
used_by: ["title"],
column: {
title: __("DOI"),
title: $__("DOI"),
data: "title_doi",
searchable: true,
orderable: true,
@ -84,7 +85,7 @@ export default {
{
used_by: ["title"],
column: {
title: __("Print ISSN"),
title: $__("Print ISSN"),
data: "print_issn",
searchable: true,
orderable: true,
@ -93,7 +94,7 @@ export default {
{
used_by: ["title"],
column: {
title: __("Online ISSN"),
title: $__("Online ISSN"),
data: "online_issn",
searchable: true,
orderable: true,
@ -102,7 +103,7 @@ export default {
{
used_by: ["title"],
column: {
title: __("URI"),
title: $__("URI"),
data: "title_uri",
searchable: true,
orderable: true,

View File

@ -356,7 +356,7 @@ import { inject, ref } from "vue";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { useRouter } from "vue-router";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n/";
export default {
setup(props) {

View File

@ -49,7 +49,7 @@ import ButtonSubmit from "../ButtonSubmit.vue";
import { APIClient } from "../../fetch/api-client.js";
import UsageStatisticsReportBuilder from "./UsageStatisticsReportBuilder.vue";
import UsageStatisticsSavedReports from "./UsageStatisticsSavedReports.vue";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n/";
export default {
setup(props) {

View File

@ -27,6 +27,7 @@
import { inject, onMounted, ref, useTemplateRef, watch } from "vue";
import KohaTable from "../KohaTable.vue";
import { useRoute } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {
@ -109,7 +110,7 @@ export default {
report_display !== "usage_data_provider" &&
column_set.unshift({
title: __(
title: $__(
data_type.charAt(0).toUpperCase() + data_type.slice(1)
),
data: data_type,
@ -122,7 +123,7 @@ export default {
// Add yop if it is required
if (checkReportColumns(report_type, "YOP")) {
column_set.push({
title: __("YOP"),
title: $__("YOP"),
data: "yop",
searchable: true,
orderable: true,
@ -131,14 +132,14 @@ export default {
// Add access type if it is required
if (checkReportColumns(report_type, "Access_Type")) {
column_set.push({
title: __("Access type"),
title: $__("Access type"),
data: "access_type",
searchable: true,
orderable: true,
});
}
column_set.push({
title: __("Metric"),
title: $__("Metric"),
render: function (data, type, row, meta) {
return row.metric_type;
},
@ -149,13 +150,13 @@ export default {
if (report_display === "usage_data_provider") {
column_set.unshift({
title: __("Data provider"),
title: $__("Data provider"),
data: "name",
searchable: true,
orderable: true,
});
column_set.push({
title: __("Period total"),
title: $__("Period total"),
data: "provider_rollup_total",
searchable: true,
orderable: true,
@ -167,7 +168,7 @@ export default {
if (yearly_filter) {
months_data.forEach(month => {
column_set.push({
title: __(month.short),
title: $__(month.short),
render: function (data, type, row, meta) {
const find_correct_month =
row.erm_usage_muses.filter(
@ -195,7 +196,7 @@ export default {
if (month.active) {
const column_title = `${month.short}${abbreviated_year}`;
column_set.push({
title: __(column_title),
title: $__(column_title),
render: function (data, type, row, meta) {
const filtered_by_year =
row.erm_usage_muses.filter(
@ -228,7 +229,7 @@ export default {
years.forEach(year => {
const title = String(year);
column_set.push({
title: __(title),
title: $__(title),
render: function (data, type, row, meta) {
const find_usage = row.erm_usage_yuses.find(
item => item.year === year
@ -249,7 +250,7 @@ export default {
// Add yop if it is required
if (checkReportColumns(report_type, "YOP")) {
column_set.push({
title: __("YOP"),
title: $__("YOP"),
data: "yop",
searchable: true,
orderable: true,
@ -259,7 +260,7 @@ export default {
if (access_types && access_types.length > 0) {
access_types.forEach(access => {
column_set.push({
title: __(access),
title: $__(access),
render: function (data, type, row, meta) {
const filterByType =
row.erm_usage_muses.filter(
@ -288,7 +289,7 @@ export default {
});
} else {
column_set.push({
title: __(metric),
title: $__(metric),
render: function (data, type, row, meta) {
const filterByMetric =
row.erm_usage_muses.filter(
@ -312,7 +313,7 @@ export default {
// Add totals column if required
if (report_display === "monthly_with_totals") {
column_set.push({
title: __("Period total"),
title: $__("Period total"),
data: "usage_total",
searchable: true,
orderable: true,

View File

@ -60,7 +60,7 @@ import ButtonSubmit from "../ButtonSubmit.vue";
import { APIClient } from "../../fetch/api-client.js";
import { inject, onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -23,7 +23,7 @@ import {
useTemplateRef,
} from "vue";
import { useRoute } from "vue-router";
import { $__ } from "../i18n";
import { $__ } from "@k/i18n";
DataTable.use(DataTablesLib);

View File

@ -33,6 +33,7 @@ import Dialog from "../Dialog.vue";
import { APIClient } from "../../fetch/api-client.js";
import "vue-select/dist/vue-select.css";
import { storeToRefs } from "pinia";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -120,7 +120,7 @@ import { inject, ref } from "vue";
import { APIClient } from "../../fetch/api-client.js";
import { storeToRefs } from "pinia";
import SettingsProcessings from "./SettingsProcessings.vue";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -47,7 +47,7 @@
<script>
import { inject, onMounted, ref } from "vue";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -200,8 +200,8 @@
<script>
import { inject, onMounted, ref } from "vue";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "../../i18n";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -92,7 +92,7 @@ import { APIClient } from "../../fetch/api-client.js";
import Toolbar from "../Toolbar.vue";
import ToolbarButton from "../ToolbarButton.vue";
import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -98,7 +98,7 @@ import { useDataTable } from "../../composables/datatables";
import Toolbar from "../Toolbar.vue";
import ToolbarButton from "../ToolbarButton.vue";
import { useRouter } from "vue-router";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
setup(props) {
@ -178,7 +178,7 @@ export default {
{
name: "train_id",
type: "relationshipSelect",
label: __("Select a train"),
label: $__("Select a train"),
required: true,
relationshipAPIClient:
APIClient.preservation.trains,
@ -281,7 +281,7 @@ export default {
let checkbox = createVNode("input", {
...(!train_item.processing.letter_code && {
disabled: "disabled",
title: __(
title: $__(
"Cannot print slip, this item does not have a processing with a letter template defined."
),
}),
@ -318,7 +318,7 @@ export default {
"aria-hidden": "true",
}),
" ",
__("Edit"),
$__("Edit"),
]
);
@ -337,7 +337,7 @@ export default {
"aria-hidden": "true",
}),
" ",
__("Remove"),
$__("Remove"),
]
);
let buttons = [editButton, " ", removeButton];
@ -362,7 +362,7 @@ export default {
"aria-hidden": "true",
}),
" ",
__("Copy"),
$__("Copy"),
]
)
);
@ -383,7 +383,7 @@ export default {
class: "fa fa-print",
"aria-hidden": "true",
}),
__("Print slip"),
$__("Print slip"),
]
);
buttons.push(" ");

View File

@ -10,7 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
props: {
@ -28,12 +28,12 @@ export default {
name: "status_filter",
type: "radio",
options: [
{ value: "", description: __("All") },
{ value: "closed", description: __("Closed") },
{ value: "sent", description: __("Sent") },
{ value: "", description: $__("All") },
{ value: "closed", description: $__("Closed") },
{ value: "sent", description: $__("Sent") },
{
value: "received",
description: __("Received"),
description: $__("Received"),
},
],
default: "",
@ -72,7 +72,7 @@ export default {
params: { train_id: resource?.train_id },
},
icon: "plus",
title: instancedResource.$__("Add items"),
title: $__("Add items"),
index: -1,
}
: {},
@ -82,7 +82,7 @@ export default {
? {
onClick: () => closeTrain(resource),
icon: "remove",
title: instancedResource.$__("Close"),
title: $__("Close"),
}
: {},
resource?.closed_on &&
@ -91,7 +91,7 @@ export default {
? {
onClick: () => sendTrain(resource),
icon: "paper-plane",
title: instancedResource.$__("Send"),
title: $__("Send"),
}
: {},
resource?.closed_on &&
@ -100,7 +100,7 @@ export default {
? {
onClick: () => receiveTrain(resource),
icon: "inbox",
title: instancedResource.$__("Receive"),
title: $__("Receive"),
}
: {},
],
@ -120,16 +120,16 @@ export default {
APIClient.preservation.httpClient._baseURL + "trains",
addFiltersToList: true,
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this train?"
),
deleteSuccessMessage: __("Train %s deleted"),
displayName: __("Train"),
displayNameLowerCase: __("train"),
displayNamePlural: __("Train"),
editLabel: __("Edit train #%s"),
emptyListMessage: __("There are no trains defined"),
newLabel: __("New train"),
deleteSuccessMessage: $__("Train %s deleted"),
displayName: $__("Train"),
displayNameLowerCase: $__("train"),
displayNamePlural: $__("Train"),
editLabel: $__("Edit train #%s"),
emptyListMessage: $__("There are no trains defined"),
newLabel: $__("New train"),
},
config,
props,
@ -139,13 +139,13 @@ export default {
resourceAttrs: [
{
name: "train_id",
label: __("ID"),
label: $__("ID"),
type: "text",
hideIn: ["Form", "Show"],
},
{
name: "name",
label: __("Name"),
label: $__("Name"),
required: true,
type: "text",
},
@ -153,13 +153,13 @@ export default {
name: "description",
required: true,
type: "textarea",
label: __("Description"),
label: $__("Description"),
hideIn: ["List"],
},
{
name: "not_for_loan",
type: "select",
label: __("Status for item added to this train"),
label: $__("Status for item added to this train"),
avCat: "av_notforloan",
disabled: train => (train.train_id ? true : false),
defaultValue:
@ -169,7 +169,7 @@ export default {
{
name: "default_processing_id",
type: "relationshipSelect",
label: __("Default processing"),
label: $__("Default processing"),
required: true,
relationshipAPIClient: APIClient.preservation.processings,
relationshipOptionLabelAttr: "name",
@ -183,14 +183,14 @@ export default {
{
name: "created_on",
type: "date",
label: __("Created on"),
label: $__("Created on"),
required: false,
hideIn: ["Form", "Show"],
},
{
name: "closed_on",
type: "date",
label: __("Closed on"),
label: $__("Closed on"),
required: false,
format: format_date,
hidden: resource => resource.closed_on,
@ -199,7 +199,7 @@ export default {
{
name: "sent_on",
type: "date",
label: __("Sent on"),
label: $__("Sent on"),
required: false,
format: format_date,
hidden: resource => resource.sent_on,
@ -208,7 +208,7 @@ export default {
{
name: "received_on",
type: "date",
label: __("Received on"),
label: $__("Received on"),
required: false,
format: format_date,
hidden: resource => resource.received_on,
@ -220,7 +220,7 @@ export default {
const doAddItems = (train, dt, event) => {
if (train.closed_on != null) {
baseResource.setWarning(
baseResource.$__("Cannot add items to a closed train")
$__("Cannot add items to a closed train")
);
} else {
baseResource.router.push({
@ -253,7 +253,7 @@ export default {
"delete",
{
addItems: {
text: baseResource.$__("Add items"),
text: $__("Add items"),
icon: "fa fa-plus",
callback: doAddItems,
},
@ -276,9 +276,7 @@ export default {
if (train_id) {
client.trains.update(train, train_id).then(
success => {
baseResource.setMessage(
baseResource.$__("Train updated")
);
baseResource.setMessage($__("Train updated"));
baseResource.router.push({ name: "TrainsList" });
},
error => {}
@ -286,9 +284,7 @@ export default {
} else {
client.trains.create(train).then(
success => {
baseResource.setMessage(
baseResource.$__("Train created")
);
baseResource.setMessage($__("Train created"));
baseResource.router.push({ name: "TrainsList" });
},
error => {}
@ -296,7 +292,7 @@ export default {
}
};
const getTableFilterFormElementsLabel = () => {
return baseResource.$__("Filter by:");
return $__("Filter by:");
};
const tableUrl = filters => {
let url = baseResource.getResourceTableUrl();
@ -415,7 +411,7 @@ export default {
return [
{
type: "component",
name: baseResource.$__("Items"),
name: $__("Items"),
hidden: train => train.items.length,
componentPath: "./Preservation/TrainItemsTable.vue",
componentProps: {

View File

@ -150,8 +150,8 @@
<script>
import { inject, onBeforeMount, ref } from "vue";
import { APIClient } from "../../fetch/api-client";
import { $__ } from "../../i18n";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -107,8 +107,8 @@
<script>
import { inject, onBeforeMount, ref } from "vue";
import { APIClient } from "../../fetch/api-client";
import { $__ } from "../../i18n";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "@k/i18n";
export default {
setup() {

View File

@ -10,6 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "@k/i18n";
export default {
props: {
@ -33,21 +34,19 @@ export default {
if (result.length) {
if (result.length != items.length) {
instancedResource.setWarning(
instancedResource
.$__(
"%s new items added. %s items not found."
)
.format(
result.length,
items.length - result.length
),
$__(
"%s new items added. %s items not found."
).format(
result.length,
items.length - result.length
),
true
);
} else {
instancedResource.setMessage(
instancedResource
.$__("%s new items added.")
.format(result.length),
$__("%s new items added.").format(
result.length
),
true
);
}
@ -61,9 +60,7 @@ export default {
instancedResource.refreshTemplateState();
}
} else {
instancedResource.setWarning(
instancedResource.$__("No items added")
);
instancedResource.setWarning($__("No items added"));
}
},
error => {}
@ -90,19 +87,14 @@ export default {
onClick: () =>
instancedResource.setConfirmationDialog(
{
title: instancedResource.$__(
"Add items to waiting list"
),
accept_label: instancedResource.$__("Save"),
cancel_label:
instancedResource.$__("Cancel"),
title: $__("Add items to waiting list"),
accept_label: $__("Save"),
cancel_label: $__("Cancel"),
inputs: [
{
name: "barcode_list",
type: "textarea",
label: instancedResource.$__(
"Barcode list"
),
label: $__("Barcode list"),
required: true,
},
],
@ -111,27 +103,21 @@ export default {
addItemsToWaitingList
),
icon: "plus",
title: instancedResource.$__("Add to waiting list"),
title: $__("Add to waiting list"),
},
instancedResource.itemsRecentlyAddedToWaitingList.length > 0
? {
onClick: () =>
instancedResource.setConfirmationDialog(
{
title: instancedResource.$__(
"Add items to a train"
),
accept_label:
instancedResource.$__("Save"),
cancel_label:
instancedResource.$__("Cancel"),
title: $__("Add items to a train"),
accept_label: $__("Save"),
cancel_label: $__("Cancel"),
inputs: [
{
name: "train_id_selected_for_add",
type: "relationshipSelect",
label: instancedResource.$__(
"Select a train"
),
label: $__("Select a train"),
required: true,
relationshipAPIClient:
APIClient.preservation
@ -147,7 +133,7 @@ export default {
addItemsToTrain
),
icon: "plus",
title: instancedResource.$__(
title: $__(
"Add last %s items to a train".format(
instancedResource
.itemsRecentlyAddedToWaitingList
@ -175,16 +161,16 @@ export default {
APIClient.preservation.httpClient._baseURL +
"/waiting-list/items",
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this item from the waiting list?"
),
deleteSuccessMessage: __("Item removed from the waiting list"),
displayName: __("Item"),
displayNameLowerCase: __("item"),
displayNamePlural: __("Items"),
deleteSuccessMessage: $__("Item removed from the waiting list"),
displayName: $__("Item"),
displayNameLowerCase: $__("item"),
displayNamePlural: $__("Items"),
editLabel: null,
emptyListMessage: __("There are no items in the waiting list"),
newLabel: __("Add to waiting list"),
emptyListMessage: $__("There are no items in the waiting list"),
newLabel: $__("Add to waiting list"),
},
config,
itemsRecentlyAddedToWaitingList,
@ -194,17 +180,17 @@ export default {
resourceAttrs: [
{
name: "itemnumber",
label: __("ID"),
label: $__("ID"),
type: "text",
hideIn: ["List"],
},
{
name: "biblio.title",
label: __("Title"),
label: $__("Title"),
type: "text",
tableColumnDefinition: {
data: "biblio.title",
title: __("Title"),
title: $__("Title"),
searchable: true,
orderable: true,
render: function (data, type, row, meta) {
@ -214,17 +200,17 @@ export default {
},
{
name: "biblio.author",
label: __("Author"),
label: $__("Author"),
type: "text",
},
{
name: "callnumber",
label: __("Call number"),
label: $__("Call number"),
type: "text",
},
{
name: "external_id",
label: __("Barcode"),
label: $__("Barcode"),
type: "text",
},
],
@ -233,21 +219,19 @@ export default {
const doRemoveItem = (item, dt, event) => {
baseResource.setConfirmationDialog(
{
title: baseResource.$__(
title: $__(
"Are you sure you want to remove this item from the waiting list?"
),
message: item.barcode,
accept_label: baseResource.$__("Yes, remove"),
cancel_label: baseResource.$__("No, do not remove"),
accept_label: $__("Yes, remove"),
cancel_label: $__("No, do not remove"),
},
() => {
const client = APIClient.preservation;
client.waiting_list_items.delete(item.item_id).then(
success => {
baseResource.setMessage(
baseResource.$__(
"Item removed from the waiting list"
),
$__("Item removed from the waiting list"),
true
);
dt.draw();
@ -268,7 +252,7 @@ export default {
"-1": [
{
removeItem: {
text: baseResource.$__("Remove"),
text: $__("Remove"),
icon: "fa fa-close",
callback: doRemoveItem,
},

View File

@ -25,6 +25,7 @@ import Toolbar from "./Toolbar.vue";
import { ref, inject, onBeforeMount, computed } from "vue";
import { APIClient } from "../fetch/api-client.js";
import KohaTable from "./KohaTable.vue";
import { $__ } from "@k/i18n";
export default {
inheritAttrs: false,
@ -196,7 +197,7 @@ export default {
orderable: true,
render: function (data, type, row, meta) {
return escape_str(
row[`${attr.name}`] ? __("Yes") : __("No")
row[`${attr.name}`] ? $__("Yes") : $__("No")
);
},
});

View File

@ -10,7 +10,6 @@
v-for="(button, i) in toolbarButtons(
resource,
component,
i18n,
componentPropData
)"
>
@ -29,7 +28,6 @@ export default {
toolbarButtons: Function,
component: String,
resource: Object,
i18n: Object,
componentPropData: Object,
sticky: {
type: Boolean,

View File

@ -10,7 +10,7 @@ import BaseResource from "../BaseResource.vue";
import { useBaseResource } from "../../composables/base-resource.js";
import { storeToRefs } from "pinia";
import { APIClient } from "../../fetch/api-client.js";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
props: {
@ -33,7 +33,7 @@ export default {
return {
form: [
{
title: instancedResource.$__("Save"),
title: $__("Save"),
icon: "save",
form: componentData.resourceForm,
},
@ -41,7 +41,7 @@ export default {
to: {
name: "VendorList",
},
title: instancedResource.$__("Cancel"),
title: $__("Cancel"),
icon: "times",
cssClass: "btn btn-link",
},
@ -61,14 +61,14 @@ export default {
resourceTableUrl:
APIClient.acquisition.httpClient._baseURL + "vendors",
i18n: {
deleteConfirmationMessage: __(
deleteConfirmationMessage: $__(
"Are you sure you want to remove this vendor?"
),
deleteSuccessMessage: __("Vendor %s deleted"),
displayName: __("Vendor"),
editLabel: __("Edit vendor #%s"),
emptyListMessage: __("There are no vendors defined"),
newLabel: __("New vendor"),
deleteSuccessMessage: $__("Vendor %s deleted"),
displayName: $__("Vendor"),
editLabel: $__("Edit vendor #%s"),
emptyListMessage: $__("There are no vendors defined"),
newLabel: $__("New vendor"),
},
props,
moduleStore: "vendorStore",
@ -79,7 +79,7 @@ export default {
{
name: "id",
group: $__("Details"),
label: __("ID"),
label: $__("ID"),
type: "text",
hideIn: ["Form", "Show"],
},
@ -88,13 +88,13 @@ export default {
group: $__("Details"),
required: true,
type: "text",
label: __("Vendor name"),
label: $__("Vendor name"),
},
{
name: "postal",
group: $__("Details"),
type: "textarea",
label: __("Postal address"),
label: $__("Postal address"),
textAreaRows: 3,
hideIn: ["List"],
},
@ -102,7 +102,7 @@ export default {
name: "physical",
group: $__("Details"),
type: "textarea",
label: __("Physical address"),
label: $__("Physical address"),
textAreaRows: 3,
hideIn: ["List"],
},
@ -110,28 +110,28 @@ export default {
name: "phone",
group: $__("Details"),
type: "text",
label: __("Phone"),
label: $__("Phone"),
hideIn: ["List"],
},
{
name: "fax",
group: $__("Details"),
type: "text",
label: __("Fax"),
label: $__("Fax"),
hideIn: ["List"],
},
{
name: "url",
group: $__("Details"),
type: "text",
label: __("Website"),
label: $__("Website"),
hideIn: ["List"],
},
{
name: "accountnumber",
group: $__("Details"),
type: "text",
label: __("Account number"),
label: $__("Account number"),
hideIn: ["List"],
},
{
@ -162,9 +162,9 @@ export default {
resourceProperty: "aliases",
},
relationshipStrings: {
nameLowerCase: __("alias"),
nameUpperCase: __("Alias"),
namePlural: __("aliases"),
nameLowerCase: $__("alias"),
nameUpperCase: $__("Alias"),
namePlural: $__("aliases"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -177,7 +177,7 @@ export default {
{
name: "alias",
type: "text",
label: __("Alias"),
label: $__("Alias"),
indexRequired: true,
},
],
@ -252,9 +252,9 @@ export default {
resourceProperty: "contacts",
},
relationshipStrings: {
nameLowerCase: __("contact"),
nameUpperCase: __("Contact"),
namePlural: __("contacts"),
nameLowerCase: $__("contact"),
nameUpperCase: $__("Contact"),
namePlural: $__("contacts"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -278,43 +278,43 @@ export default {
{
name: "name",
type: "text",
label: __("Name"),
label: $__("Name"),
indexRequired: true,
},
{
name: "position",
type: "text",
label: __("Position"),
label: $__("Position"),
indexRequired: true,
},
{
name: "phone",
type: "text",
label: __("Phone"),
label: $__("Phone"),
indexRequired: true,
},
{
name: "altphone",
type: "text",
label: __("Alternative phone"),
label: $__("Alternative phone"),
indexRequired: true,
},
{
name: "fax",
type: "text",
label: __("Fax"),
label: $__("Fax"),
indexRequired: true,
},
{
name: "email",
type: "text",
label: __("Email"),
label: $__("Email"),
indexRequired: true,
},
{
name: "notes",
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
{
@ -335,7 +335,7 @@ export default {
{
name: "interfaces",
type: "relationshipWidget",
group: __("Interfaces"),
group: $__("Interfaces"),
showElement: {
type: "component",
hidden: vendor => !!vendor.interfaces?.length,
@ -352,9 +352,9 @@ export default {
resourceProperty: "interfaces",
},
relationshipStrings: {
nameLowerCase: __("interface"),
nameUpperCase: __("Interface"),
namePlural: __("interfaces"),
nameLowerCase: $__("interface"),
nameUpperCase: $__("Interface"),
namePlural: $__("interfaces"),
},
newRelationshipDefaultAttrs: {
type: "object",
@ -373,7 +373,7 @@ export default {
{
name: "name",
type: "text",
label: __("Name"),
label: $__("Name"),
indexRequired: true,
},
{
@ -386,31 +386,31 @@ export default {
{
name: "uri",
type: "text",
label: __("URI"),
label: $__("URI"),
indexRequired: true,
},
{
name: "login",
type: "text",
label: __("Login"),
label: $__("Login"),
indexRequired: true,
},
{
name: "password",
type: "text",
label: __("Password"),
label: $__("Password"),
indexRequired: true,
},
{
name: "account_email",
type: "text",
label: __("Account email"),
label: $__("Account email"),
indexRequired: true,
},
{
name: "notes",
type: "text",
label: __("Notes"),
label: $__("Notes"),
indexRequired: true,
},
],
@ -432,7 +432,7 @@ export default {
name: "list_currency",
group: $__("Ordering information"),
type: "select",
label: __("List prices are"),
label: $__("List prices are"),
selectLabel: "currency",
requiredKey: "currency",
options: currencies.value,
@ -445,7 +445,7 @@ export default {
type: "select",
selectLabel: "currency",
requiredKey: "currency",
label: __("Invoice prices are"),
label: $__("Invoice prices are"),
options: currencies.value,
defaultValue: null,
},
@ -489,7 +489,7 @@ export default {
name: "tax_rate",
group: $__("Ordering information"),
type: "select",
label: __("Tax rate"),
label: $__("Tax rate"),
options: gstValues.value,
defaultValue: null,
hideIn: ["List"],
@ -498,7 +498,7 @@ export default {
name: "discount",
group: $__("Ordering information"),
type: "number",
label: __("Discount"),
label: $__("Discount"),
defaultValue: null,
size: 6,
formErrorHandler: verifyDiscountValue,
@ -511,14 +511,14 @@ export default {
name: "deliverytime",
group: $__("Ordering information"),
type: "number",
label: __("Delivery time (days)"),
label: $__("Delivery time (days)"),
hideIn: ["List"],
},
{
name: "notes",
group: $__("Ordering information"),
type: "textarea",
label: __("Notes"),
label: $__("Notes"),
hideIn: ["List"],
},
{
@ -534,7 +534,7 @@ export default {
row.id +
'" class="show">' +
escape_str(
__("%s basket(s)").format(
$__("%s basket(s)").format(
row.baskets_count
)
) +
@ -558,7 +558,7 @@ export default {
"&searched=1" +
'" class="show">' +
escape_str(
__("%s subscription(s)").format(
$__("%s subscription(s)").format(
row.subscriptions_count
)
) +
@ -580,8 +580,8 @@ export default {
add_filters: true,
filters_options: {
1: [
{ _id: 0, _str: baseResource.$__("Inactive") },
{ _id: 1, _str: baseResource.$__("Active") },
{ _id: 0, _str: $__("Inactive") },
{ _id: 1, _str: $__("Active") },
],
...(baseResource.map_av_dt_filter("av_vendor_types").length && {
2: () => baseResource.map_av_dt_filter("av_vendor_types"),
@ -593,7 +593,7 @@ export default {
"edit",
{
delete: {
text: baseResource.$__("Delete"),
text: $__("Delete"),
icon: "fa fa-trash",
should_display: row =>
row.baskets_count === 0 &&
@ -603,7 +603,7 @@ export default {
},
{
receive: {
text: baseResource.$__("Receive shipments"),
text: $__("Receive shipments"),
icon: "fa fa-inbox",
should_display: row =>
row.active &&
@ -655,7 +655,7 @@ export default {
delete vendor.invoices_count;
if (vendor.discount && !verifyDiscountValue(vendor.discount))
errors.push(baseResource.$__("Invalid discount value"));
errors.push($__("Invalid discount value"));
vendor.contacts = checkContactOrInterface(
vendor.contacts.map(
@ -679,9 +679,7 @@ export default {
if (vendorId) {
baseResource.apiClient.update(vendor, vendorId).then(
success => {
baseResource.setMessage(
baseResource.$__("Vendor updated")
);
baseResource.setMessage($__("Vendor updated"));
baseResource.router.push({ name: "VendorList" });
},
error => {}
@ -689,9 +687,7 @@ export default {
} else {
baseResource.apiClient.create(vendor).then(
success => {
baseResource.setMessage(
baseResource.$__("Vendor created")
);
baseResource.setMessage($__("Vendor created"));
baseResource.router.push({ name: "VendorList" });
},
error => {}
@ -744,7 +740,7 @@ export default {
value: {
columns: [
{
title: __("Name"),
title: $__("Name"),
data: "contractname",
render: function (
data,
@ -760,11 +756,11 @@ export default {
},
},
{
title: __("Description"),
title: $__("Description"),
data: "contractdescription",
},
{
title: __("Start date"),
title: $__("Start date"),
data: "contractstartdate",
render: function (
data,
@ -780,7 +776,7 @@ export default {
},
},
{
title: __("End date"),
title: $__("End date"),
data: "contractenddate",
render: function (
data,
@ -800,7 +796,7 @@ export default {
)
? [
{
title: __("Actions"),
title: $__("Actions"),
data: "contractnumber",
searchable: false,
orderable: false,
@ -813,11 +809,11 @@ export default {
return (
`<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-pencil" aria-hidden="true"></i>` +
" " +
__("Edit") +
$__("Edit") +
"</a>" +
`<a style="margin-left: 5px;" class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-trash-can" aria-hidden="true"></i>` +
" " +
__("Delete") +
$__("Delete") +
"</a>"
);
},

View File

@ -1,8 +1,8 @@
import { computed, inject, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { $__ } from "../i18n";
import { build_url } from "../composables/datatables";
import { storeToRefs } from "pinia";
import { $__, $__x, $__n, $__nx, $__p, $__px, $__np, $__npx } from "@k/i18n";
export function useBaseResource(instancedResource) {
const router = useRouter();
@ -31,6 +31,8 @@ export function useBaseResource(instancedResource) {
}
}
let i18n = instancedResource.i18n;
const format_date = $date;
const patron_to_html = $patron_to_html;
@ -169,7 +171,7 @@ export function useBaseResource(instancedResource) {
*
* @return {Object} keys must be "list", "show" or "edit", values are functions.
*/
const defaultToolbarButtons = (resource, i18n) => {
const defaultToolbarButtons = resource => {
return {
list: [
{
@ -411,7 +413,7 @@ export function useBaseResource(instancedResource) {
setConfirmationDialog(
{
title: instancedResource.i18n.deleteConfirmationMessage,
title: i18n.deleteConfirmationMessage,
message: resourceName,
accept_label: $__("Yes, delete"),
cancel_label: $__("No, do not delete"),
@ -420,9 +422,7 @@ export function useBaseResource(instancedResource) {
instancedResource.apiClient.delete(resourceId).then(
success => {
setMessage(
instancedResource.i18n.deleteSuccessMessage.format(
resourceName
),
i18n.deleteSuccessMessage.format(resourceName),
true
);
if (typeof callback === "function") {
@ -491,23 +491,22 @@ export function useBaseResource(instancedResource) {
/**
* A function that returns a set of buttons to display in the toolbar, based on the current resource and component.
* The function takes three arguments: the resource, the component and the i18n object.
* The function takes two arguments: the resource and the component.
* It returns an array of buttons. The buttons are a combination of the default buttons and the additional buttons.
* The default buttons are defined in the defaultToolbarButtons function and the additional buttons are defined in the
* additionalToolbarButtons function at the resource level.
*
* @param {Object} resource The current resource
* @param {String} component The current component
* @param {Object} i18n The i18n object
* @return {Array<Object>} An array of buttons
*/
const toolbarButtons = computed(() => {
return (resource, component, i18n, componentData) => {
return (resource, component, componentData) => {
const defaultButtons = instancedResource.hasOwnProperty(
"defaultToolbarButtons"
)
? instancedResource.defaultToolbarButtons(resource, i18n)
: defaultToolbarButtons(resource, i18n);
? instancedResource.defaultToolbarButtons(resource)
: defaultToolbarButtons(resource);
const additionalButtons = instancedResource.hasOwnProperty(
"additionalToolbarButtons"
)
@ -662,6 +661,6 @@ export function useBaseResource(instancedResource) {
build_url,
route,
router,
$__,
i18n,
};
}

View File

@ -38,7 +38,7 @@ import { routes as routesDef } from "../routes/acquisitions";
import { useMainStore } from "../stores/main";
import { useVendorStore } from "../stores/vendors";
import { useNavigationStore } from "../stores/navigation";
import i18n from "../i18n";
import i18n from "@k/i18n";
const pinia = createPinia();

View File

@ -32,7 +32,7 @@ const router = createRouter({
});
import App from "../../components/Admin/RecordSources/Main.vue";
import i18n from "../../i18n";
import i18n from "@k/i18n";
const app = createApp(App);

View File

@ -25,7 +25,7 @@ import { useVendorStore } from "../stores/vendors";
import { useERMStore } from "../stores/erm";
import { useNavigationStore } from "../stores/navigation";
import { useReportsStore } from "../stores/usage-reports";
import i18n from "../i18n";
import i18n from "@k/i18n";
const pinia = createPinia();

View File

@ -34,7 +34,7 @@ import { routes as routesDef } from "../routes/preservation";
import { useMainStore } from "../stores/main";
import { usePreservationStore } from "../stores/preservation";
import { useNavigationStore } from "../stores/navigation";
import i18n from "../i18n";
import i18n from "@k/i18n";
const pinia = createPinia();

View File

@ -3,7 +3,7 @@ import { markRaw } from "vue";
import Home from "../components/Vendors/Home.vue";
import ResourceWrapper from "../components/ResourceWrapper.vue";
import { $__ } from "../i18n";
import { $__ } from "@k/i18n";
const vendorSearchBreadcrumb = ({ match, query }) => {
if (!query || !query.supplier) return match.meta.self;

View File

@ -2,7 +2,7 @@ import { markRaw } from "vue";
import ResourceWrapper from "../../components/ResourceWrapper.vue";
import { $__ } from "../../i18n";
import { $__ } from "@k/i18n";
export default {
title: $__("Administration"),

View File

@ -18,7 +18,7 @@ import UsageStatisticsReportsViewer from "../components/ERM/UsageStatisticsRepor
import ResourceWrapper from "../components/ResourceWrapper.vue";
import { $__ } from "../i18n";
import { $__ } from "@k/i18n";
export const routes = [
{

View File

@ -9,7 +9,7 @@ import SettingsProcessingsFormAdd from "../components/Preservation/SettingsProce
import ResourceWrapper from "../components/ResourceWrapper.vue";
import { $__ } from "../i18n";
import { $__ } from "@k/i18n";
export const routes = [
{

View File

@ -1,6 +1,7 @@
import { defineStore } from "pinia";
import { reactive, toRefs } from "vue";
import { withAuthorisedValueActions } from "../composables/authorisedValues";
import { $__ } from "@k/i18n";
export const useERMStore = defineStore("erm", () => {
const store = reactive({
@ -28,36 +29,36 @@ export const useERMStore = defineStore("erm", () => {
av_title_reports_metrics: "ERM_TITLE_REPORTS_METRICS",
av_item_reports_metrics: "ERM_ITEM_REPORTS_METRICS",
av_agreement_relationships: [
{ value: "supersedes", description: __("supersedes") },
{ value: "supersedes", description: $__("supersedes") },
{
value: "is-superseded-by",
description: __("is superseded by"),
description: $__("is superseded by"),
},
{
value: "provides_post-cancellation_access_for",
description: __("provides post-cancellation access for"),
description: $__("provides post-cancellation access for"),
},
{
value: "has-post-cancellation-access-in",
description: __("has post-cancellation access in"),
description: $__("has post-cancellation access in"),
},
{
value: "tracks_demand-driven_acquisitions_for",
description: __("tracks demand-driven acquisitions for"),
description: $__("tracks demand-driven acquisitions for"),
},
{
value: "has-demand-driven-acquisitions-in",
description: __("has demand-driven acquisitions in"),
description: $__("has demand-driven acquisitions in"),
},
{
value: "has_backfile_in",
description: __("has backfile in"),
description: $__("has backfile in"),
},
{
value: "has_frontfile_in",
description: __("has frontfile in"),
description: $__("has frontfile in"),
},
{ value: "related_to", description: __("related to") },
{ value: "related_to", description: $__("related to") },
],
},
});

View File

@ -1,5 +1,6 @@
import { defineStore } from "pinia";
import { reactive, toRefs } from "vue";
import { $__ } from "@k/i18n";
export const useReportsStore = defineStore("reports", () => {
const store = reactive({
@ -25,7 +26,7 @@ export const useReportsStore = defineStore("reports", () => {
active: true,
used_by: ["title", "item", "database", "platform"],
column: {
title: __("Data provider"),
title: $__("Data provider"),
data: "provider_name",
searchable: true,
orderable: true,
@ -37,7 +38,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["title", "item", "database"],
column: {
title: __("Publisher"),
title: $__("Publisher"),
data: "publisher",
searchable: true,
orderable: true,
@ -49,7 +50,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["item", "database", "platform"],
column: {
title: __("Platform"),
title: $__("Platform"),
data: "platform",
searchable: true,
orderable: true,
@ -61,7 +62,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["title", "database"],
column: {
title: __("Publisher ID"),
title: $__("Publisher ID"),
data: "publisher_id",
searchable: true,
orderable: true,
@ -73,7 +74,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["title"],
column: {
title: __("Online ISSN"),
title: $__("Online ISSN"),
data: "online_issn",
searchable: true,
orderable: true,
@ -85,7 +86,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["title"],
column: {
title: __("Print ISSN"),
title: $__("Print ISSN"),
data: "print_issn",
searchable: true,
orderable: true,
@ -97,7 +98,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["title"],
column: {
title: __("DOI"),
title: $__("DOI"),
data: "title_doi",
searchable: true,
orderable: true,
@ -109,7 +110,7 @@ export const useReportsStore = defineStore("reports", () => {
active: false,
used_by: ["title"],
column: {
title: __("URI"),
title: $__("URI"),
data: "title_uri",
searchable: true,
orderable: true,

View File

@ -11,6 +11,10 @@ module.exports = [
__dirname,
"koha-tmpl/intranet-tmpl/prog/js/fetch"
),
"@k": path.resolve(
__dirname,
"koha-tmpl/intranet-tmpl/prog/js/vue"
),
},
},
entry: {