Skip to content

[Translator] Move the var/translations folder in the build_dir #1642

Closed
@smnandre

Description

@smnandre

Currently, UX Translator bundle uses the var/translations directory

When warming up the Symfony cache, all of your translations will be dumped as JavaScript into the var/translations/ directory. For a better developer experience, TypeScript types definitions are also generated aside those JavaScript files.

https://symfony.com/bundles/ux-translator/current/index.html#usage

Directory not found / not writable

But this directory is no standardized, and is not "buildable" (as the ... build directory).

And... this directory is not created by the the Kernel (it does it for cache_dir and build_dir)

It may be then created during cache:warming but for most of the standard deployment tools, any folder not explicitely marked as writable is not..

And so this happens: (folder not writable)

W: + mkdir var/translations
W: mkdir: cannot create directory ‘var/translations’: File exists

And this happens (asset not found)

  W: 11:36:57 WARNING   [asset_mapper] Unable to find asset "../translator" imported from "/app/assets/controllers/translator-demo-controller.js". Try adding ".js" to the end of the import - i.e. "../translator.js".

Use the build dir ?

For me the best choice would be to use the build_dir.

There are other individual solutions, but the build dir is made for this and would remove any future problem too.

So my question is... ..... can we do it or is this a BC ? And..... how ? (as it's currently in the importmap of people)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions