Where to configure languages for iQvoc (labels and interface language)?
EwaSniegowskaPCSS opened this issue · 3 comments
Hi, I'm trying to configure iQvoc to use other than predefined languages.
I tried to alter the code. I put:
Iqvoc.config['languages.pref_labeling'] = ['pl', 'en', 'uk']
Iqvoc.config['languages.further_labelings.Labeling::SKOS::AltLabel'] = ['pl', 'en', 'uk']
Iqvoc.config['languages.notes'] = ['pl', 'en', 'uk']
at the end of config/initializers/iqvoc.rb
file.
I try to run application then but I get an error during bundle exec rake db:migrate
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "configuration_settings" does not exist
LINE 8: WHERE a.attrelid = '"configuration_settings"'...
^
Without my code alterations the migration is successful.
I'm not sure where should I put this configuration code.
If the language configuration is indeed stored in a table,
maybe I could alter it using db/seeds.rb
file? This would be easier
for me as I expect different deployments of the application with different
language preferences and it would be nice not to have to build a separate
docker image for each of them, just override the seeds
file before migration.
I thought that maybe analysing/altering the content of "configuration_settings" table might be helpful, but it's empty for an application with default labels (en/de).
Hi @EwaSniegowskaPCSS, thanks for your interest in iQvoc.
Via app ui
You do not need to put your language configuration into an initializer. You can change configuration during runtime at /en/config.html
After saving you're able to add labels in configured languages:
via rails initlializer
Put this into an initializers (e.g. config/initializers/iqvoc.rb
)
Iqvoc.config do |config|
config.register_settings({
'available_languages' => ['pl', 'en', 'uk'],
'languages.pref_labeling' => ['pl', 'en', 'uk'],
'languages.notes' => ['pl', 'en', 'uk']
})
end
Please make sure that you provide a localisation file if you set a custom language (see config/locales/ for supported languages)
Thank you very much for the answer,
unfortunately I could only test it now.
Everything works as expected.
I also added the fragment:
'languages.further_labelings.Labeling::SKOS::AltLabel' => ['fr'],
to configure Alternative labels
.
I have a question regarding an option Secondary
in the Language
menu.
I read about it in the release notes:
It's also possible to translate secondary concept relations by switching the secondary language.
But I don't fully understand it. Would it be possible for you
to provide a screenshot that illustrates this feature?