Skip to content

Added trans filter to templates#1520

Merged
Vainonen merged 2 commits intoskosmos-3from
issue1503-add-trans-filters
Sep 21, 2023
Merged

Added trans filter to templates#1520
Vainonen merged 2 commits intoskosmos-3from
issue1503-add-trans-filters

Conversation

@Vainonen
Copy link
Contributor

@Vainonen Vainonen commented Sep 21, 2023

Reasons for creating this PR

New Symfony translation component added to skosmos-3 branch. Translation tags/filters notation has changed from previously used.

Link to relevant issue(s), if any

Description of the changes in this PR

trans filters added to Twig templates and inc files. Translation files containing variables in their identifiers are translated with notation {% trans %} ... %variable% ... {% endtrans %}

Known problems or uncertainties in this PR

I could not find what causes and how to test this error message in file concept-card.inc:
{% trans %}Error: Term "{{ term }}" not found in vocabulary!{% endtrans %}

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@Vainonen Vainonen added this to the 3.0 milestone Sep 21, 2023
@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (c2e9bdd) 70.51% compared to head (c105173) 70.51%.

Additional details and impacted files
@@             Coverage Diff              @@
##             skosmos-3    #1520   +/-   ##
============================================
  Coverage        70.51%   70.51%           
  Complexity        1642     1642           
============================================
  Files               32       32           
  Lines             4314     4314           
============================================
  Hits              3042     3042           
  Misses            1272     1272           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@osma osma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK, except that the concept page is currently broken. Viewing http://localhost/Skosmos/yso/en/page/p12345 I get this error in the logs:

PHP Fatal error:  Uncaught Twig\\Error\\SyntaxError: A message inside a trans tag must be a simple text. in /var/www/html/Skosmos/src/view/concept-card.inc:186

The solution is to use %term% instead of {{ term }} in the template (see comment)

Other than this, LGTM!

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Vainonen Vainonen merged commit bc516cf into skosmos-3 Sep 21, 2023
@Vainonen Vainonen deleted the issue1503-add-trans-filters branch September 21, 2023 13:01
@osma osma modified the milestones: 3.x, 3.0 Jan 22, 2025
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

Successfully merging this pull request may close these issues.

2 participants