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

Asset Maintenance type "PAT Test" text is hard-coded, no translation #11769

Closed
2 tasks done
rnelsonee opened this issue Sep 1, 2022 · 1 comment
Closed
2 tasks done

Comments

@rnelsonee
Copy link

rnelsonee commented Sep 1, 2022

Debug mode

Describe the bug

The source code to generate lists of maintenances (getImprovementOptions function) has one option -- 'PAT Test' -- hard-coded rather than using the translation provided by localization options.

Reproduction steps

  1. Navigate file browser to resources/lang/es-MX/admin/asset_maintenances/general.php
  2. Change 'PAT Test' to 'PAT prueba' on line 15
  3. Save file
  4. Go to Snipe-it admin settings in your browser
  5. Go to Localization and set language to "Spanish, Mexico"
  6. Go to an Asset in Snipe-it
  7. Click on Maintenances tab
  8. Note that one option is still "PAT Test"

Expected behavior

The option should show "PAT prueba"

Screenshots

This shows the code that causes this bug

aGLH4v6

Snipe-IT Version

6.0.10

Operating System

Ubuntu

Web Server

Apache

PHP Version

8.1.9

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

The bug is caused by an error in app/Models/AssetMaintenance.php where "PAT Test" is hard-coded in English. So any future translations will not work.

We need to change

    public static function getImprovementOptions()
    {
        return [
            trans('admin/asset_maintenances/general.maintenance') => trans('admin/asset_maintenances/general.maintenance'),
            trans('admin/asset_maintenances/general.repair')      => trans('admin/asset_maintenances/general.repair'),
            trans('admin/asset_maintenances/general.upgrade')     => trans('admin/asset_maintenances/general.upgrade'),
            'PAT test'      => 'PAT test',
            trans('admin/asset_maintenances/general.calibration')     => trans('admin/asset_maintenances/general.calibration'),

to

    public static function getImprovementOptions()
    {
        return [
            trans('admin/asset_maintenances/general.maintenance') => trans('admin/asset_maintenances/general.maintenance'),
            trans('admin/asset_maintenances/general.repair')      => trans('admin/asset_maintenances/general.repair'),
            trans('admin/asset_maintenances/general.upgrade')     => trans('admin/asset_maintenances/general.upgrade'),
            trans('admin/asset_maintenances/general.pat_test')     => trans('admin/asset_maintenances/general.pat_test'),
            trans('admin/asset_maintenances/general.calibration')     => trans('admin/asset_maintenances/general.calibration'),

Other context, this is my first bug report on Github. And if this bug is given a number, I'll attempt a PR to fix it.

@welcome
Copy link

welcome bot commented Sep 1, 2022

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

rnelsonee pushed a commit to rnelsonee/snipe-it that referenced this issue Sep 1, 2022
snipe added a commit that referenced this issue Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant