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

Where to configure languages for iQvoc (labels and interface language)? #434

Open
EwaSniegowskaPCSS opened this issue May 12, 2022 · 3 comments

Comments

@EwaSniegowskaPCSS
Copy link

EwaSniegowskaPCSS commented May 12, 2022

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.

@EwaSniegowskaPCSS
Copy link
Author

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).

@mjansing
Copy link
Contributor

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

Screenshot 2022-05-19 at 11 50 44

After saving you're able to add labels in configured languages:

Screenshot 2022-05-19 at 11 55 24

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)

@EwaSniegowskaPCSS
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants