Mass import API: set work language

Description

In order to import works in languages other than English, the API needs to accept a language_code string and then convert it to the language_id supported by the Archive. The string will need to match the ISO short name for the language (eg: "en" for locale-neutral English, "es" for Spanish etc) as this can then be matched to the "short" column in the Archive database.

The StoryParser already supports adding the "language_id" to a work, so it's just a matter of handling this properly in the API. AO3-4605 covers wiring the language option into the UI.

Testing Notes
This is covered by an automated test but can be tested manually from RubyMine by pasting this code block (see instructions here), or this can be adapted to a REST client of your choice (token for Test will be provided on request and remember to set the archivist to an account with archivist permissions on Test):

The resulting work should then have its language set to Spanish.

Indirect Testing

To ease testing, I’ve set half the works on this page to Spanish, and half to German, so importing them should create a work with one or the other: http://od-import.transformativeworks.org/test/authors?letter=M - to import using the API, click on the Import All button beside the author’s name.

Activity

Show:
redsummernight
April 7, 2019, 2:31 PM

http://od-import.transformativeworks.org/test/authors?letter=M

Looks good.

Sarken
April 8, 2019, 9:59 AM

I did “Import All” on “M Author 11” and https://test.archiveofourown.org/works/1069447 had its language set to German.

Looks good!

Lady Oscar
April 11, 2019, 1:46 AM

Looks good!

DeployedToBeta

Assignee

Ariana

Reporter

Ariana

Roadmap

Work Importing

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Required Access Level

Archivist

Milestone

Internal 0.9