Skip to content

Compile to FormatJS compiled format with formatphp compile CLI command #95

@ramsey

Description

@ramsey

Compile to FormatJS compiled format with formatphp compile CLI command

We already have the compilation capability built-in to FormatPHP, for validation purposes. We should expose this to users through a formatphp compile command that works similarly to the formatjs compile command.

This will enable sharing the same translation files across front-end and back-end code.

Background/problem

FormatJS has a special compilation step that helps improve performance and efficiency internally, since it's a type of AST for translation strings. You can read more about the compile command here:

FormatPHP already implements the same AST compilation process in order to validate messages. We need to expose this as a compile command to output the AST and save to a file. With this functionality, users could merge their translation files to usethe same ones for front-end and back-end.

Proposal/solution

Add a compile command to the FormatPHP CLI tool that mirrors the functionality of the FormatJS command of the same name: https://formatjs.io/docs/tooling/cli#compilation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions