Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PWA): broken translation strings #2359

Merged
merged 6 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/components/AttendanceCalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { createResource } from "frappe-ui"

const dayjs = inject("$dayjs")
const employee = inject("$employee")
const __ = inject("$translate")
const firstOfMonth = ref(dayjs().date(1).startOf("D"))

const colorMap = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/EmployeeAdvanceItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { computed, inject } from "vue"

import ListItem from "@/components/ListItem.vue"
import EmployeeAdvanceIcon from "@/components/icons/EmployeeAdvanceIcon.vue"
import { formatCurrency } from "@/utils/formatters";
import { formatCurrency } from "@/utils/formatters"

const dayjs = inject("$dayjs")
const props = defineProps({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/EmptyState.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
props.isTableField ? 'border-2 border-dashed border-gray-300 mt-5' : '',
]"
>
{{ props.message }}
{{ __(props.message) }}
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ExpenseAdvancesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</div>
</div>

<EmptyState v-else :message="__('No advances found')" :isTableField="true" />
<EmptyState v-else message="No advances found" :isTableField="true" />
</template>

<script setup>
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/components/ExpenseItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ __("{0}: {1}", null, [
__("Sanctioned"),
formatCurrency(item.sanctioned_amount || 0, currency),
]) }}
{{
__("{0}: {1}", [
__("Sanctioned"),
formatCurrency(item.sanctioned_amount || 0, currency),
])
}}
</span>
<span class="whitespace-pre"> &middot; </span>
<span class="whitespace-nowrap" v-if="item.expense_date">
Expand All @@ -43,7 +45,7 @@
import { computed, inject } from "vue"

import { getCompanyCurrency } from "@/data/currencies"
import { formatCurrency } from "@/utils/formatters";
import { formatCurrency } from "@/utils/formatters"

const props = defineProps({
doc: {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/ExpenseTaxesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

<script setup>
import { FeatherIcon, createResource } from "frappe-ui"
import { computed, ref, watch } from "vue"
import { computed, ref, watch, inject } from "vue"

import FormField from "@/components/FormField.vue"
import EmptyState from "@/components/EmptyState.vue"
Expand All @@ -154,6 +154,7 @@ const emit = defineEmits([
"update-expense-tax",
"delete-expense-tax",
])
const __ = inject("$translate")
const expenseTax = ref({})
const editingIdx = ref(null)

Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/ExpensesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ __("{0}: {1}", null, [
__("Sanctioned"),
formatCurrency(item.sanctioned_amount || 0, currency),
]) }}
{{
__("{0}: {1}", [
__("Sanctioned"),
formatCurrency(item.sanctioned_amount || 0, currency),
])
}}
</span>
<span class="whitespace-pre"> &middot; </span>
<span class="whitespace-nowrap" v-if="item.expense_date">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
:disabled="isReadOnly"
/>

<ErrorMessage :message="__(props.errorMessage)" />
<ErrorMessage :message="props.errorMessage" />
</div>
</template>

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/FormView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ const props = defineProps({
})
const emit = defineEmits(["validateForm", "update:modelValue"])
const router = useRouter()

const __ = inject("$translate")

let activeTab = ref(props.tabs?.[0].name)
let fileAttachments = ref([])
let statusColor = ref("")
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</div>
</div>
<EmptyState
:message="__('No {0} found', [__(props.doctype)])"
:message="`No ${props.doctype?.toLowerCase()}s found`"
v-else-if="!documents.loading"
/>

Expand Down
17 changes: 10 additions & 7 deletions frontend/src/components/RequestActionSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,21 @@ const approvalField = computed(() => {
})

const getSuccessMessage = ({ status = "", docstatus = 0 }) => {
if (status) return __([status], __('{0} successfully!'))
else if (docstatus)
return __('Document {0}', [
if (status) {
return __("{0} successfully!", [__(status)])
} else if (docstatus) {
return __("Document {0} successfully!", [
docstatus === 1 ? __("submitted") : __("cancelled")]
, __('successfully!'))
)
}
}

const getFailureMessage = ({ status = "", docstatus = 0 }) => {
if (status)
return __([status === __("Approved") ? __("Approval") : __("Rejection")], '{0}failed!')
else if (docstatus)
if (status) {
return __("{0} failed!", [status === __("Approved") ? __("Approval") : __("Rejection")])
} else if (docstatus) {
return __('Document {0} failed!', [docstatus === 1 ? __("submission") : __("cancellation")])
}
}

const updateDocumentStatus = ({ status = "", docstatus = 0 }) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/RequestList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</Button>
</router-link>
</div>
<EmptyState :message="emptyStateMessage || __('You have no requests')" v-else />
<EmptyState :message="emptyStateMessage || 'You have no requests'" v-else />

<ion-modal
ref="modal"
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/components/SalarySlipItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ __("{0}: {1}", null, [
{{
__("{0}: {1}", [
__("Gross Pay"),
formatCurrency(doc.gross_pay, doc.currency),
]) }}
])
}}
</span>
<span class="whitespace-pre"> &middot; </span>
</div>
Expand Down Expand Up @@ -49,9 +51,9 @@ const title = computed(() => {
return dayjs(props.doc.start_date).format("MMM YYYY")
} else {
// quarterly, bimonthly, etc
return `${dayjs(props.doc.start_date).format("MMM YYYY")} - ${dayjs(props.doc.end_date).format(
"MMM YYYY"
)}`
return `${dayjs(props.doc.start_date).format("MMM YYYY")} - ${dayjs(
props.doc.end_date
).format("MMM YYYY")}`
}
})
</script>
5 changes: 4 additions & 1 deletion frontend/src/components/WorkflowActionSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@

<script setup>
import { IonActionSheet, modalController } from "@ionic/vue"
import { computed, ref, onMounted } from "vue"
import { computed, ref, onMounted, inject } from "vue"
import { FeatherIcon } from "frappe-ui"

const props = defineProps({
doc: {
type: Object,
Expand All @@ -68,6 +69,8 @@ const emit = defineEmits(["workflow-applied"])
let showActionSheet = ref(false)
let actions = ref([])

const __ = inject("$translate")

const getTransitions = async () => {
const transitions = await props.workflow.getTransitions(props.doc)
actions.value = transitions.map((transition) => {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/views/attendance/ShiftAssignmentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
</template>

<script setup>
import { inject } from "vue"
import { IonPage } from "@ionic/vue"
import ListView from "@/components/ListView.vue"

const __ = inject("$translate")

const SHIFT_ASSIGNMENT_FIELDS = ["name", "shift_type", "start_date", "end_date", "docstatus"]
const FILTER_CONFIG = [
{
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/attendance/ShiftRequestList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
</template>

<script setup>
import { inject } from "vue"
import { IonPage } from "@ionic/vue"
import ListView from "@/components/ListView.vue"

const __ = inject("$translate")
const TAB_BUTTONS = ["My Requests", "Team Requests"]
const SHIFT_REQUEST_FIELDS = [
"name",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/salary_slip/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</router-link>
</div>
</div>
<EmptyState :message="__('No salary slips found')" v-else />
<EmptyState message="No salary slips found" v-else />
</div>
</div>
</template>
Expand Down
Loading