Skip to content
A XLIFF parser gem
Branch: master
Clone or download
Latest commit 22776ef Jun 24, 2016

Build Status Test Coverage Code Climate


XLIFFer helps you to parse xliff files and get their content. You can read and modify your xliff files with it.


require 'xliffer'

# Opens a xliff file - can be a file descriptor or a string.
xliff ='file.xml'))

# get the first file definition on this XLIFF.
file = xliff.files.first

# prints the name of this file
puts file.original

# Prints the source and target languages from this file.
puts file.source_language
puts file.target_language

# Prints all string and the translations on this file.
file.strings.each do |string|
  puts  "#{string.source} => #{}"

# Changes the translation of texts "hi" to "oi"
file.strings.find_all { |s| s.source = "hi" }.each do |string| = "oi"

# Modifies the translation of a string in the file with the given id,
# or add the translation if don't exist
file['target-string-id'].target = "new translation to this id"

# Generate the new xml file with the change
puts xliff.to_s


  • Read all fields according to 1.2 specification
You can’t perform that action at this time.