mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
fix: preserve spaces in translation
This commit is contained in:
parent
9b30142cf0
commit
8ba9f7f510
@ -409,16 +409,13 @@ module.exports = class BaseDocument extends Observable {
|
||||
// check for conflict
|
||||
if (currentDoc && this.modified != currentDoc.modified) {
|
||||
throw new frappe.errors.Conflict(
|
||||
frappe.t('Document {0} {1} has been modified after loading', [
|
||||
this.doctype,
|
||||
this.name,
|
||||
])
|
||||
frappe.t`Document ${this.doctype} ${this.name} has been modified after loading`
|
||||
);
|
||||
}
|
||||
|
||||
if (this.submitted && !this.meta.isSubmittable) {
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe.t('Document type {1} is not submittable', [this.doctype])
|
||||
frappe.t`Document type ${this.doctype} is not submittable`
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -34,17 +34,16 @@ class TranslationString {
|
||||
}
|
||||
|
||||
#translate(segment) {
|
||||
const startSpace = segment.match(/^\s+/)?.[0] ?? '';
|
||||
const endSpace = segment.match(/\s+$/)?.[0] ?? '';
|
||||
segment = segment.replace(/\s+/g, ' ').trim();
|
||||
// TODO: implement translation backend
|
||||
return segment;
|
||||
// segment = translate(segment)
|
||||
return startSpace + segment + endSpace;
|
||||
}
|
||||
|
||||
#formatArg(arg) {
|
||||
if (typeof arg === 'undefined') {
|
||||
return ' ';
|
||||
}
|
||||
|
||||
return ` ${arg} `;
|
||||
return arg ?? '';
|
||||
}
|
||||
|
||||
#stitch() {
|
||||
|
12
src/utils.js
12
src/utils.js
@ -34,10 +34,7 @@ export async function showMessageDialog({
|
||||
export function deleteDocWithPrompt(doc) {
|
||||
return new Promise((resolve) => {
|
||||
showMessageDialog({
|
||||
message: t('Are you sure you want to delete {0} "{1}"?', [
|
||||
doc.doctype,
|
||||
doc.name,
|
||||
]),
|
||||
message: t`Are you sure you want to delete ${doc.doctype} "${doc.name}"?`,
|
||||
description: t('This action is permanent'),
|
||||
buttons: [
|
||||
{
|
||||
@ -65,11 +62,8 @@ export function deleteDocWithPrompt(doc) {
|
||||
export function cancelDocWithPrompt(doc) {
|
||||
return new Promise((resolve) => {
|
||||
showMessageDialog({
|
||||
message: t('Are you sure you want to cancel {0} "{1}"?', [
|
||||
doc.doctype,
|
||||
doc.name,
|
||||
]),
|
||||
description: t('This action is permanent'),
|
||||
message: t`Are you sure you want to cancel ${doc.doctype} ${doc.name}?`,
|
||||
description: t`This action is permanent`,
|
||||
buttons: [
|
||||
{
|
||||
label: t('Yes'),
|
||||
|
Loading…
Reference in New Issue
Block a user