Class: Rosette::Tms::Repository
- Inherits:
-
Object
- Object
- Rosette::Tms::Repository
- Defined in:
- lib/rosette/tms/repository.rb
Instance Method Summary collapse
-
#checksum_for(locale, commit_id) ⇒ String
Calculates a single unique value for the phrases and translations associated with a given commit id.
-
#finalize(commit_id) ⇒ Object
Signals the repository to perform any cleanup tasks that may be required for the given commit once it’s been fully processed.
-
#initialize(configurator) ⇒ Repository
constructor
Creates a new instance of this repository.
-
#lookup_translation(locale, phrase) ⇒ String
Retrieves a single translation for the given phrase.
-
#lookup_translations(locale, phrases) ⇒ Array<String>
Retrieves a list of translations for the given phrases.
-
#status(commit_id) ⇒ TranslationStatus
Collects and calculates status information for the phrases contained in the given commit as well as their translations per locale.
-
#store_phrase(phrase, commit_id) ⇒ void
Publishes a phrase in the repository.
-
#store_phrases(phrases, commit_id) ⇒ void
Publishes a list of phrases in the repository.
Constructor Details
#initialize(configurator) ⇒ Repository
Creates a new instance of this repository.
11 12 |
# File 'lib/rosette/tms/repository.rb', line 11 def initialize(configurator) end |
Instance Method Details
#checksum_for(locale, commit_id) ⇒ String
Calculates a single unique value for the phrases and translations associated with a given commit id. Often this is calculated using a one-way hash like MD5 or SHA1. Checksum values can be compared to determine when translations for the given commit id have changed.
69 70 71 72 |
# File 'lib/rosette/tms/repository.rb', line 69 def checksum_for(locale, commit_id) raise NotImplementedError, 'expected to be implemented in derived classes' end |
#finalize(commit_id) ⇒ Object
Signals the repository to perform any cleanup tasks that may be required for the given commit once it’s been fully processed.
88 89 90 91 |
# File 'lib/rosette/tms/repository.rb', line 88 def finalize(commit_id) raise NotImplementedError, 'expected to be implemented in derived classes' end |
#lookup_translation(locale, phrase) ⇒ String
Retrieves a single translation for the given phrase.
32 33 34 35 |
# File 'lib/rosette/tms/repository.rb', line 32 def lookup_translation(locale, phrase) raise NotImplementedError, 'expected to be implemented in derived classes' end |
#lookup_translations(locale, phrases) ⇒ Array<String>
Retrieves a list of translations for the given phrases.
22 23 24 25 |
# File 'lib/rosette/tms/repository.rb', line 22 def lookup_translations(locale, phrases) raise NotImplementedError, 'expected to be implemented in derived classes' end |
#status(commit_id) ⇒ TranslationStatus
Collects and calculates status information for the phrases contained in the given commit as well as their translations per locale.
79 80 81 82 |
# File 'lib/rosette/tms/repository.rb', line 79 def status(commit_id) raise NotImplementedError, 'expected to be implemented in derived classes' end |
#store_phrase(phrase, commit_id) ⇒ void
This method returns an undefined value.
Publishes a phrase in the repository. For web-based translation management systems, this probably means uploading the phrase over HTTP.
55 56 57 58 |
# File 'lib/rosette/tms/repository.rb', line 55 def store_phrase(phrase, commit_id) raise NotImplementedError, 'expected to be implemented in derived classes' end |
#store_phrases(phrases, commit_id) ⇒ void
This method returns an undefined value.
Publishes a list of phrases in the repository. For web-based translation management systems, this probably means uploading phrases to be translated over HTTP.
44 45 46 47 |
# File 'lib/rosette/tms/repository.rb', line 44 def store_phrases(phrases, commit_id) raise NotImplementedError, 'expected to be implemented in derived classes' end |