Skip to content

Instantly share code, notes, and snippets.

@romanlehnert
Created June 10, 2014 08:31
Show Gist options
  • Save romanlehnert/b4e3947bde8a7bcb2afd to your computer and use it in GitHub Desktop.
Save romanlehnert/b4e3947bde8a7bcb2afd to your computer and use it in GitHub Desktop.
Phrase exclusion and skipping of verification
# This is part of a "locale" model, we use.
#
# @name contains the handle of the locale, e.g. "de-AT", or "da-DK".
# this way, we exclude a key in phrase. It works perfect.
def exclude_key_in_phrase(key)
HTTParty.post('https://phraseapp.com/api/v1/translations/store.json',
query: {
auth_token: Phrase.auth_token,
locale: @name.to_s,
key: key.to_s,
excluded_from_export: 1
}
)
end
# this way, we try to skip the verification of a key in phrase.
def skip_verifikation_of_key_in_phrase(key)
HTTParty.post('https://phraseapp.com/api/v1/translations/store.json',
query: {
auth_token: Phrase.auth_token,
locale: @name.to_s,
key: key.to_s,
skip_verification: 1
}
)
end
# unfortunately this does not work.
# Thre response of the request does not give a hint if the skipping was saved.
=> {
"content" => nil,
"plural_suffix" => "",
"placeholders" => [],
"unverified" => false,
"excluded_from_export" => true,
"translation_key" => {
"id" => 3524518,
"name" => "download_section.tmh_agb.heading",
"name_plural" => "",
"description" => "",
"data_type" => "string",
"pluralized" => false,
"tag_list" => [],
"unformatted" => false,
"xml_space_preserve" => nil,
"max_characters_allowed" => 0
}
}
# And in the webinterface of phrase, the key in the given locale is
# still not skipped at verification.
# (The button "skip verification" is not active.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment