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

TextCollector Task throws many Warnings #823

Open
2 tasks done
davejtoews opened this issue Feb 7, 2024 · 2 comments
Open
2 tasks done

TextCollector Task throws many Warnings #823

davejtoews opened this issue Feb 7, 2024 · 2 comments

Comments

@davejtoews
Copy link

Module version(s) affected

5,6,7

Description

The output of the i18nTextCollectorTask returns a number of warnings coming from this module. All are of two types:

[User Warning] Error concatenating localisation key
GET /dev/tasks/i18nTextCollectorTask?

Line 737 in /var/www/html/vendor/silverstripe/framework/src/i18n/TextCollection/i18nTextCollector.php
[User Notice] Missing localisation default for key Localisation
GET /dev/tasks/i18nTextCollectorTask

Line 815 in /var/www/html/vendor/silverstripe/framework/src/i18n/TextCollection/i18nTextCollector.php

Each instance of the second appears to be a direct result of the first.

How to reproduce

Run /dev/tasks/i18nTextCollectorTask with the environment set to dev or error reporting otherwise set to display PHP warnings.

Possible Solution

The issue appears to be due to the use of the __TRAIT__ magic constant w/in _t() function calls in FluentAdminTrait, FluentBadgeTrait and FluentObjectTrait. The backslashes in the fully namespaced trait name cannot be parsed.

It should be possible to resolve by replacing all instances of __TRAIT__ with the string name of the class, or a function call which strips the namespace from the result.

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
@davejtoews
Copy link
Author

davejtoews commented Feb 8, 2024

This issue was originally flagged here: #656 (comment)

davejtoews added a commit to davejtoews/silverstripe-fluent that referenced this issue Feb 8, 2024
davejtoews added a commit to davejtoews/silverstripe-fluent that referenced this issue Feb 8, 2024
fixes tractorcow-farm#823 - The magic method __TRAIT__ was inserting namespaces into
localization keys, containing slashed that could not be parsed by the
TextCollector task. These have been replaced w/ the Trait name as a
string
davejtoews added a commit to davejtoews/silverstripe-fluent that referenced this issue Feb 8, 2024
fixes tractorcow-farm#823 - The magic constant __TRAIT__ was inserting namespaces into
localization keys, containing slashed that could not be parsed by the
TextCollector task. These have been replaced w/ the Trait name as a
string
davejtoews added a commit to davejtoews/silverstripe-fluent that referenced this issue Feb 8, 2024
fixes tractorcow-farm#823 - The magic constant __TRAIT__ was inserting namespaces into
localization keys, containing slashes that could not be parsed by the
TextCollector task. These have been replaced w/ the Trait name as a
string
@GuySartorelli
Copy link
Contributor

Sounds more like there's a bug in textcollector which should correctly support __TRAIT__.

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

2 participants