Closed Bug 1449509 Opened 6 years ago Closed 1 year ago

Conditional CONCAT

Categories

(Localization Infrastructure and Tools :: Fluent Migration, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: stas, Unassigned)

References

Details

In bug 1445694 comment 12 Zibi is requesting a feature to conditionally prefix/postfix Transforms with whitespace.

One approach to provide this would be to introduce two new transforms, APPEND and PREPEND which only return something if the first argument is not None.

FTL.Message(
    id=FTL.Identifier('sync-signedin-unverified'),
    value=CONCAT(
        APPEND(
            COPY(
                'browser/chrome/browser/preferences/sync.dtd',
                'signedInUnverified.beforename.label',
            ),
            FTL.TextElement(' ')
        ),
        EXTERNAL_ARGUMENT('email'),
        PREPEND(
            COPY(
                'browser/chrome/browser/preferences/sync.dtd',
                'signedInUnverified.aftername.label',
            ),
            FTL.TextElement(' ')
        )
    )
)

Another approach would be to add before/after parameters to COPY:

FTL.Message(
    id=FTL.Identifier('sync-signedin-unverified'),
    value=CONCAT(
        COPY(
            'browser/chrome/browser/preferences/sync.dtd',
            'signedInUnverified.beforename.label',
            after=FTL.TextElement(' ')
        ),
        EXTERNAL_ARGUMENT('email'),
        COPY(
            'browser/chrome/browser/preferences/sync.dtd',
            'signedInUnverified.aftername.label',
            before=FTL.TextElement(' ')
        )
    ),
)

The first approach is more versatile, however, because it's more composable: you can use any FTL Node or Transform as the predicate.
No longer blocks: fluent.migrate
Component: Python Library → Fluent Migration
Product: L20n → Localization Infrastructure and Tools

Closing as WONTFIX due to lack of practical user interest.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.