Skip to content

Access translation through dot notation? #504

Answered by ivanhofer
gterras asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gterras you have the possibility to access it like you would do with any regular object:

$LL['LINE']['FOO']()

// or with dynamic keys
const part1 = 'LINE' as const
const part2 = 'FOO' as const
$LL[part1][part2]()

Accessing the object via a string split by . is not supported out of the box.
You would need to write a custom function in order to do that. It will probably require some additional effort if you want to keep the typesafety in place.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by gterras
Comment options

You must be logged in to vote
6 replies
@gterras
Comment options

@gterras
Comment options

@ivanhofer
Comment options

@gterras
Comment options

@ivanhofer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants