compile translation files to AST for efficiency
Description
Environment
Potential Workaround
Attachments
blocks
is cloned by
relates to
Checklist
hideTestRail: Results
Activity
Zak Burke May 28, 2021 at 10:09 AM
, strictly speaking, we didn't put a deadline on this work so it is not required. That said, from a dev point of view, the change is small, low risk (no code changes), and improves the DX by cleaning up the console. From an end-user's point of view, there is no impact except a minor performance improvement.

Denys Bohdan May 28, 2021 at 9:57 AM
is this work needed for Juniper? Do we need to release modules that only these changes since last release?

Peter Murray April 9, 2021 at 4:11 PM
Sounds good—thanks for the details, .
Zak Burke April 9, 2021 at 2:12 AM
, has done the work to automate the process of compiling the existing locale.json
files into AST files so there shouldn't be any work for devops, and all devs will have to do is configure the compilation script in each repo, a one-time config task.

Peter Murray April 7, 2021 at 1:41 PM
I looked in Lokalise, and there isn't an "AST" format available. Hopefully this isn't too much of a burden for the developers/devops teams to create.
Details
Details
Assignee

As noted in the formatjs documentation and in FOLIO's javascript console, translation values should be precompiled for efficiency:
Compiling the messages is easy, but there's a bit of grunt work to configure it all correctly that, should be centralized into
stripes-cli
so it can be managed automatically as part of thestripes build
command. We'll also need to updatestripes-core
to use the pre-compiled files when they are available and to fall back to the current, uncompiled files when they are not available.For an individual repository for an individual locale, the steps looks like this:
add
@formatjs/cli
as a dev-depadd a translation-compilation hook to the
package.json
scripts
section, e.g."formatjs-compile": "formatjs compile"
provide a formatter (our translation-file syntax exactly matches the required output syntax, so this is dead simple):
parse the translations for each locale:
update
Jenkinsfile
so compilation and testing are both handled byrunScripts
, in order: