Comments (12)
Hi
a perfect
thats amazing
so we have a
a) a new extension
b) new snippet pattern in that files
great
ill do it
thanks a lot :)
from phpunuhi.
you can test dev-master with the new scanner
should work now, QA not started yet but unit tests are all passing
from phpunuhi.
Hi
ok got it, stupid me. forgot to ask the scanner implementation what file extension to use
accidentally always used TWIG
now its dynamic and should work in dev-master :)
from phpunuhi.
Great, I've tested the fix on the dev-main and it works 👍
The last step to make the CI validation work is the compatibility for mjml with the validate:all
command. I suppose it's better to create another ticket for this?
from phpunuhi.
hi
thanks for this great idea
so i think frosh also uses twig. that means snippets have a different syntax? or do you need same snippet twig syntax with a different file extension?
thanks
from phpunuhi.
The FroshPlatformTemplateMail plugin supports MJML formats which makes styling emails much easier. In those templates, the MJML extension is used instead of twig.
Example folder structure with MJML files.
MJML content with snippets.
<mjml>
<mj-body mj-class="body">
<mj-wrapper mj-class="body__wrapper">
<mj-section mj-class="content">
<mj-column>
<mj-text>
<h1>{{ 'email.contact.subject'|trans|sw_sanitize }}</h1>
<p>{{ 'email.contact.intro'|trans|sw_sanitize }}</p>
...
</mj-text>
</mj-column>
</mj-section>
</mj-wrapper>
</mj-body>
</mjml>
In this example the snippets in the MJML file are not detected by the twig-scanner.
email.contact.subject
email.contact.intro
from phpunuhi.
Thanks for the fast response!
I've tested the feature on the dev-main branch but it still does not recognize the .mjml
files? Do I have to activate to MJML-scanner?
#1 [EMPTY_CONTENT] Found empty translation
- Locale: en-GB
- File: /.../.../.../.../src/xyz/Resources/snippet/storefront.en-GB.json
- Line: 30
[x]: email.contact.intro
from phpunuhi.
you need to use the scanner:usage command
the detection in files is integrating with an external system from the frameworks point of view (so twig files)
and its not 100% correct...because snippets might not appear inside templates but could be used inside PHP scripts....
so the basic idea on scanners is to get some quick insight in what MIGHT not be used :)
php bin/console scanner:usage .... --scanner=mjml --dir=xyz
that should work
from phpunuhi.
I'm running php vendor/bin/phpunuhi scan:usage --dir=./src --scanner=mjml --set=General
but still get the following errors:
+-------+----------------------------------------------------+----------------------------------------------------------------------------------+
| # | Keys (2) | Error |
+-------+----------------------------------------------------+----------------------------------------------------------------------------------+
| 1 | email.contact.intro | Key not found in any file |
| 2 | email.contact.subject | Key not found in any file |
This is my simplified configuration
from phpunuhi.
Ok that's funny because of these unit tests with the exact same data haha
https://github.com/boxblinkracer/phpunuhi/blob/main/tests/phpunit/Bundles/Scanner/MJML/MjmlScannerTest.php
could only think of the file not being found somehow
ill check it out...maybe ill add a debug output which files have been scanned
would be good right? or a verbose mode for that maybe?
from phpunuhi.
Hi
amazing thank you
yeah i didnt really want to add the scanners to the official validation command
because the result is not 100% valid....please see the warnings in the text
if snippets are added thru PHP for instance...then its okay that they are not found in those files.
so scanners are more some working helpers.....
do you have any better idea on that?
from phpunuhi.
released in 1.17.0
from phpunuhi.
Related Issues (20)
- Add JSON Report HOT 1
- Add XML Storage HOT 1
- Automatic Fixing of wrong Case Styles
- Generate reports for commands with changes to storages
- Add line number to validation reports
- Automatically remove unused keys HOT 1
- Duplicate Content check can cause problems in specific languages HOT 4
- Add "basePath" for locale list
- Allow imports of sub configuration files
- Suppress translation from validate:all command HOT 13
- Allow List for some keys and case styles
- Question about Shopware6 storage and project scope HOT 3
- Add Support for categories and shopping experiences in shopware 6 storage format HOT 1
- Shopware 6 - State machine, sorting options, and salutations translations HOT 3
- Make translations node optional if imports are used HOT 3
- The translate command is not designed for large amounts of data (Shopware6) HOT 3
- Allow to disable hierarchy HOT 1
- Import all files in directory
- Do not mark keys as missing if they have been removed from the base locale
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpunuhi.