November Happy Hour will be moved to Thursday December 5th.

How to get language specific metadata.

Vote:
 

Hi,
IV Editor manual says that metadata "field can be allowed to
contain information in multiple languages by selecting multilingual".

How to get localized metadata using client API, for example, how to get  ALT text on different languages?

BTW how to set metadata field on different languages? I have not found the way to do this from ImageVault UI.

#91190
Sep 29, 2014 13:07
Vote:
 

Hi Andrey!

Unfortunately we have not yet implemented support for handling metada in multiple languages using the UI. This is of course something that are on our roadmap since it is a feature requested by a lot of customers.

I'll ask one of my colleagues to provide an example on how to use the API.

#91260
Oct 01, 2014 9:03
Vote:
 

Hi, here is an example of setting a metadata definition to multilangual, and also create metadata in various languages.

            var client = ClientFactory.GetSdkClient();

            // Get an existing metadata definition that we want to make multilangual.
            // I'm using a filter/option approach with a template here but you can also filter out the metadata definition with client.Query if you now the ID,
            // for more information, see: http://imagevault.se/sv/dokumentation/Api-Dokumentation1/?page=csharp/examples/querymetadatadefinition.html

            var metadataDefinitionService = client.CreateChannel();

            var metadataTemplate = new MetadataDefinition {
                MetadataType = MetadataTypes.String,
                MetadataDefinitionType = MetadataDefinitionTypes.User,
                Name = "my multilang metatadadef"
            };

            var metadataDefinition = metadataDefinitionService.Find(new MetadataDefinitionQuery {
                Filter = new MetadataDefinitionFilter {
                    MetadataDefinitionType = metadataTemplate.MetadataDefinitionType,
                    MetadataType = metadataTemplate.MetadataType,
                }
            }).FirstOrDefault(m => m.Name == "my multilang metatadadef");

            if (metadataDefinition == null) {
                // in this test I know the metadata definition exists,
                // if it doesn't you can create/save the metadataDefinition here
            }

            // set multilangual property on the metadataDefinition
            metadataDefinition.IsMultilingual = true;

            // and save the metadata definition
            metadataDefinitionService.Save(metadataDefinition);

            // let's start with swedish
            // check if the language we want to use exists in IV4
            var langService = client.CreateChannel();
            var swedishLanguage = langService.GetAllLanguages().FirstOrDefault(l => String.Equals("se", l.LanguageCode, StringComparison.InvariantCultureIgnoreCase));

            if (swedishLanguage == null) {
                // the language didnt exist, so create it
                swedishLanguage = langService.Create("se");
            }

            // create a language specific metadata of this metadatadefinition. Note the usage of language ID.
            var swedishMetadata = Metadata.CreateInstance(metadataDefinition, swedishLanguage.Id, false, false, false, false);
            swedishMetadata.Value = "This is the swedish metadata";

            // now let's create another metadata of the same metadata definition, but in english
            // start by getting the language, or creating it if necessary
            var englishLanguage = langService.GetAllLanguages().FirstOrDefault(l => String.Equals("en", l.LanguageCode, StringComparison.InvariantCultureIgnoreCase));

            if (englishLanguage == null) {
                // the language didnt exist, so create it
                englishLanguage = langService.Create("en");
            }

            // create the language specific metadata. Note the usage of language.
            var englishMetadata = Metadata.CreateInstance(metadataDefinition, englishLanguage.Id, false, false, false, false);
            englishMetadata.Value = "This is the english metadata";

            // now we can load a media and assign both our swedish and english metadata to its metadata list
            var media = client.Load(1167).Include(m => m.Metadata).FirstOrDefault();
            media.Metadata.AddRange(new []{swedishMetadata, englishMetadata});

            // and then save the media, using MediaServiceSaveOptions.Metadata cause that's all we changed
            var mediaService = client.CreateChannel();
            mediaService.Save(new []{media}, MediaServiceSaveOptions.Metadata);



#91322
Edited, Oct 02, 2014 14:17
Vote:
 

Thanks for the answers!

#91359
Oct 03, 2014 10:36
Vote:
 

Hi Johan,

Do you have any idea when an update for accessing language features through the UI gets available?

Regards,

Robert.

#121455
May 11, 2015 16:25
Vote:
 

Hi!

This is still something that is fairly high in our backlog, though we have some other features that currently is prioritized higher.
We are constantly reevaluating our priorities hence i cannot give a specific date at this time.

An easy work around for now is obviously creating metadata for each language.

/Johan

#121618
May 15, 2015 11:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.