Conversation
|
Nice PR! 🚀 It is also interesting to apply it to the locale that I passed to the Example: __('validation.attributes.question', locale: 'pt-BR')Check the |
…nto Fox-for-array-translations-#18
…nto Fox-for-array-translations-#18
…nto Fox-for-array-translations-#18
|
@rmartinoscar for me, this works:
Something like this, doesn't work:
I'm afraid that feature would be impossible with the current parser. |
|
Yes cause you have return [
'requirements' => [
'sections' => [
'0' => [
'title' => 'PHP version',
],
'1' => [
'title' => 'PHP extensions',
],
]
]
];;and i have which works but the extension doesn't like it return [
'requirements' => [
'sections' => [
[
'title' => 'PHP version',
],
[
'title' => 'PHP extensions',
],
]
]
];; |
|
@joetannenbaum Would love to see that merged :) |
|
@N1ebieski Thanks for jumping on this! I appreciate the fix, but I'd like to take a slightly different approach to keep the logic clean. Instead of wrapping Something like this: export interface TranslationItem {
[key: string]: {
- value: string;
+ value: string | Record<string, unknown>;
path: string;
line: number;
params: string[];
};
}This way, we keep the implementation centralized rather than adding layers around it. |
|
@TitasGailius I’ll hold off on refactoring this PR until you decide on #443, because some of the logic is related. |






Fixes #300, #428
This PR adds support for array translations for example:
resources/lang/en/validation.php:
Currently, the code:
shows:
Translation [validation.attributes.question] not found.Laravel Extension(translation)but this key exists, it's only an array with nested elements.
This PR adds support for such keys for hovering and linking to the first element in the array. However, the value is not shown in the hover, because it's an array.
This code needs futher refactoring and testing.