Add critical rules: always Tailwind, always translate user text

- Strengthen CLAUDE.md rule 8: Tailwind with no exceptions
- Add CLAUDE.md rule 13: all user-visible text must use translation
  functions (Twig: | translate, PHP: t_var(), JS: CmsApi.t_var())
- Add t_var() reference to hooks-and-api.md and css-js-conventions.md
- Update translate entry in quick-reference.md with all 3 contexts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 10:19:22 +00:00
parent d1b78fb420
commit 05008c0045
4 changed files with 14 additions and 2 deletions

View File

@@ -99,11 +99,12 @@ Do NOT modify web-base files — they are shared across all projects.
5. Table names without `cms_` prefix everywhere
6. Primary key is `num`, never `id`
7. Upload fields are arrays — access with `[0].urlPath`
8. Tailwind CSS as primary styling, custom CSS scoped with BEM when needed
8. **Always use Tailwind CSS.** No exceptions — every style must use Tailwind utility classes. Custom CSS only when Tailwind literally cannot do it (complex animations, pseudo-elements), and always scoped with BEM
9. Twig concatenation uses `~` operator: `'value=' ~ variable`
10. `enlace` (link) fields already include slashes
11. **File hooks (`hooks/*.php`) do NOT inject variables.** Always read params manually: `$params = json_decode(file_get_contents('php://input'), true) ?: [];` — Only module hooks (`modulos/*/hook.php`) receive variables directly.
12. **`tipo` is a reserved variable.** The `.htaccess` injects `tipo=barra` on every request. Never use `tipo` as a hook parameter name — it gets overwritten, causing 404s. Use `account_type`, `user_tipo`, etc.
13. **All user-visible text must use translation functions.** Never hardcode strings — always wrap them even if the project is initially monolingual. Twig: `{{ 'Text' | translate }}`, PHP: `t_var('Text')`, JS: `CmsApi.t_var('Text')`. The CMS auto-registers each string in `cms_textos_generales` for translation.
## Documentation