Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

[Bug] with Calendar Operation Buttons month week day not translated #1235

Open AndreNeny opened 6 hours ago

AndreNeny commented 6 hours ago

Bug report

When the calendar window is displayed, everything is correct, except for the buttons which allow you to change mode between month, week, day are not translated

What I did

my language : fr For now, my translations are in the file resources/lang/backpack/calendaroperation.php

What I expected to happen

Buttons translated.

What happened

Text button : backpack.calendaroperation::calendaroperation.month / backpack.calendaroperation::calendaroperation.week ...

What I've already tried to fix it

In dev, I patched the backpack code in calendar_view.blade.php : buttonText: { today: 'Aujoud\'hui', month: 'Mois', week: 'Semaine', day: 'Jour', list: 'Liste', }, !!!

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there? Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

8.2.25

PHP EXTENSIONS:

Core, date, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, json, iconv, SPL, pcntl, random, readline, Reflection, session, standard, mbstring, SimpleXML, sockets, tokenizer, xml, mysqlnd, bcmath, curl, dba, dom, enchant, fileinfo, gd, i360, imagick, imap, intl, ldap, exif, mysqli, odbc, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, redis, soap, sodium, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, xmlreader, xmlwriter, xsl, zip, Zend OPcache

LARAVEL VERSION:

10.48.22.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.3.6 backpack/calendar-operation: 1.0.10 backpack/crud: 6.7.41 backpack/devtools: 3.1.7 backpack/editable-columns: 3.0.10 backpack/filemanager: 3.0.9 backpack/generators: v4.0.7 backpack/logmanager: v5.0.2 backpack/menucrud: v4.0.2 backpack/pagemanager: 3.3.2 backpack/permissionmanager: 7.2.1 backpack/pro: 2.2.11 backpack/settings: 3.1.1 backpack/theme-coreuiv2: 1.2.6 backpack/theme-tabler: 1.2.15

backpack-ai-bot[bot] commented 6 hours ago

Thank you for reporting this issue with the Calendar Operation in Backpack. Based on the information you've provided, it appears that the month, week, and day buttons in the calendar view are not being translated correctly for the French language. Let's address this issue:

The problem you're experiencing is indeed a bug in the latest version of Backpack's Calendar Operation. The translations for these buttons are not being applied correctly.

According to the Calendar Operation changelog, there have been some recent updates related to translations:

  1. In version 1.0.5 (21-Mar-2024), they added Italian translations.
  2. In version 1.0.4 (20-Mar-2024), they added missing translations to the calendar.

However, it seems that the French translations for these specific buttons are still not working as expected.

Your temporary fix of manually adding the translations in the calendar_view.blade.php file is a good workaround, but it's not an ideal long-term solution as it modifies the package files directly.

Here are some suggestions:

  1. Make sure you have the latest version of the Calendar Operation package installed. You can do this by running:

    composer update backpack/calendar-operation
  2. Check if there's a French translation file specifically for the Calendar Operation. It should be located in resources/lang/vendor/backpack/calendar-operation/fr/calendaroperation.php. If it doesn't exist, you might need to create it.

  3. In this file, ensure you have translations for the following keys:

    return [
       'today' => 'Aujourd\'hui',
       'month' => 'Mois',
       'week' => 'Semaine',
       'day' => 'Jour',
       'list' => 'Liste',
    ];
  4. If the issue persists, it would be helpful to report this bug to the Backpack team through their official channels or GitHub repository.

Given that this is a known issue and you've already tried updating, the best course of action would be to report this bug to the Backpack team. They may need to update their Calendar Operation package to properly handle these translations.

In the meantime, your temporary fix in the calendar_view.blade.php file is a valid workaround, although it's not ideal for long-term maintenance.

If you need further assistance or if the problem persists after trying these steps, I recommend reaching out to the Backpack support team directly, as they would have the most up-to-date information on this specific issue.

Relevant sources:

Github Issue (closed): [Bug] composer require backpack/calendar-operation failed : repository not found Github Issue (closed): Can't translate date filters with backpack files override Github Issue (closed): [Bug] Issues on "backpack/calendar-operation" Github Issue (closed): [Bug] Missing translation in date_range filter - Premade date range strings in french Github Issue (closed): [BUG] Show Button With Translation Occuer an Error In ListOperation Github Issue (closed): [Bug] calendar-operation - Invalid datetime format: 1292 when an event is moved Github Issue (closed): [Bug] Datetime picker translation Github Issue (closed): [Bug] translatable models not showing correct locale Github Issue (closed): [Bug] Cant translate date filter Calendar Operation|Calendar Operation Github Issue (closed): [Bug] Localization incomplete or not working as expected Github Issue (closed): [Bug] translatable model not showing correct language translations in edit form Github Issue (closed): [Bug] upload_multiple field translation missing

AndreNeny commented 5 hours ago

Ouaouh ! Thank's a lot Tabacitu for this so fast response ! I'll look all of that...

pxpm commented 4 hours ago

Hey @AndreNeny if you are able to paste here the contents of the translated french file we can add it to the package so that other users can benefit of it.

Here are the english keys that we would need translated to incorporate in the package:

'calendar'      => 'calendar',
    'list-view'     => 'list view',
    'calendar-view' => 'calendar view',

    'update_success' => 'Event updated successfully',
    'update_error'   => 'Failed to update event',
    'delete_success' => 'Event deleted successfully',
    'delete_error'   => 'Failed to delete event',

    'today'   => 'Today',
    'month'   => 'Month',
    'week'    => 'Week',
    'day'     => 'Day',
    'list'    => 'List',
    'all_day' => 'All day',

Cheers

AndreNeny commented 1 hour ago

euh ... Thanks TchatGPT But none of it works.

My translations fr :

'calendar' => 'calendrier', 'list-view' => 'vue liste', 'calendar-view' => 'vue calendrier',

'update_success' => 'Evénement mis à jour',
'update_error'   => 'Erreur lors de la mise à jour',
'delete_success' => 'Evénement supprimé',
'delete_error'   => 'Erreur lors de la suppression',

'today' => 'Aujourd\'hui',
'month' => 'Mois',
'week' => 'Semaine',
'day' => 'Jour',
'list' => 'Liste',
'all_day' => 'un seul jour',

Cheers