Projects and project languages
The SDK provides methods for listing and retrieving Lokalise Vantage projects and their associated languages.
List projects
Section titled “List projects”Use projects to retrieve projects belonging to a team:
projects = client.projects('team-id')
projects.each do |project| puts "#{project.project_id}: #{project.name}"endReturns a LokaliseApiNext::Collections::Vantage::Projects collection containing LokaliseApiNext::Models::Vantage::Project objects.
You can also pass pagination parameters:
projects = client.projects('team-id', limit: 20)If more results are available, use the returned cursor to retrieve the next page:
if projects.more? next_page = client.projects( 'team-id', limit: 20, after: projects.cursor )endRetrieve a project
Section titled “Retrieve a project”Use project to retrieve a single project by its ID:
project = client.project('project-id')
puts project.nameputs project.descriptionputs project.base_language['locale']puts project.target_languagesputs project.translation_settingsReturns a LokaliseApiNext::Models::Vantage::Project object.
List project languages
Section titled “List project languages”Use project_languages to retrieve all languages associated with a project:
languages = client.project_languages('project-id')
languages.each do |language| puts "#{language.language_name} (#{language.locale})"endEach language exposes its identifier, locale, name, and right-to-left writing direction flag:
language = languages.first
puts language.language_idputs language.localeputs language.language_nameputs language.is_rtlReturns a LokaliseApiNext::Collections::Vantage::ProjectLanguages collection containing LokaliseApiNext::Models::Vantage::ProjectLanguage objects.
Unlike the projects list, this endpoint does not use cursor-based pagination.