Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Arrays be translated? #92

Closed
eikaramba opened this issue Aug 8, 2022 · 7 comments · Fixed by sveltekit-i18n/base#9
Closed

Can Arrays be translated? #92

eikaramba opened this issue Aug 8, 2022 · 7 comments · Fixed by sveltekit-i18n/base#9
Assignees
Labels
base Issue related to base functionality enhancement New feature or request parsers Issue related to message parsers
Milestone

Comments

@eikaramba
Copy link

eikaramba commented Aug 8, 2022

I have a list of FAQ entries as an array of objects like

[
  {
  title:"can i do xxxxxx?"
  text:"yes you can"
  },
  .....
]

I wasn't able to translate this, is this possible? it would be nice if i can just create a faq.json put the array there and use it via $t('faqs').

@jarda-svoboda
Copy link
Member

jarda-svoboda commented Aug 8, 2022

Hi.)
Currently it works like:

// faqs.json
{
  faqs: [
    {
      title:"can i do xxxxxx?",
      text:"yes you can"
    }
  ]
}
// page.svelte
$t('faqs.0.title');

@jarda-svoboda jarda-svoboda added question Further information is requested base Issue related to base functionality labels Aug 8, 2022
@eikaramba
Copy link
Author

yes that works, but the problem is that i am not able to get ALL Faq entries with that approach. basically i just want to retrieve all FAQ entries and filter them based on some query. doing $t('faqs') did not work for me. should it?

@jarda-svoboda jarda-svoboda added enhancement New feature or request and removed question Further information is requested labels Aug 9, 2022
@jarda-svoboda
Copy link
Member

Ok, it’s currently not designed to work this way.. However it can be useful so I’m adding it.

@eikaramba
Copy link
Author

wow thanks, yeah that would be great. just had another case were this would be super helpful

@Suya1671
Copy link

Any updates on this? I would really like to be able to do this

@CannonPhelps
Copy link

I would really love to see this happen! I need it in projects!

@Anastasia199129
Copy link

Anastasia199129 commented Feb 24, 2023

Tell me please, has not yet appeared a function for enumeration of arrays?

@jarda-svoboda jarda-svoboda added this to the 2.3.0 milestone Jul 4, 2023
@jarda-svoboda jarda-svoboda self-assigned this Jul 4, 2023
@jarda-svoboda jarda-svoboda added the parsers Issue related to message parsers label Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base Issue related to base functionality enhancement New feature or request parsers Issue related to message parsers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants