-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6f40b0
commit baa42b7
Showing
4 changed files
with
27 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
module Export | ||
class AccommodationSerializer < ActiveModel::Serializer | ||
attributes :code, | ||
:phrases | ||
|
||
def self.collection_serialize(collection) | ||
ActiveModelSerializers::SerializableResource.new(collection, each_serializer: self) | ||
end | ||
|
||
def phrases | ||
|
||
words = {} | ||
|
||
I18n.available_locales.each do |locale| | ||
#It is not a bug that note and question are the same. In Oneclick Legacy, there is no question | ||
I18n.locale = locale | ||
words[locale] = {name: TranslationEngine.translate_text(object.name), note: TranslationEngine.translate_text(object.note), question: TranslationEngine.translate_text(object.note)} | ||
end | ||
|
||
words | ||
end | ||
class AccommodationSerializer < EligibilitySerializer | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
module Export | ||
class CharacteristicSerializer < ActiveModel::Serializer | ||
attributes :code, | ||
:phrases | ||
|
||
def self.collection_serialize(collection) | ||
ActiveModelSerializers::SerializableResource.new(collection, each_serializer: self) | ||
end | ||
|
||
def phrases | ||
|
||
words = {} | ||
|
||
I18n.available_locales.each do |locale| | ||
#It is not a bug that note and question are the same. In Oneclick Legacy, there is no question | ||
I18n.locale = locale | ||
words[locale] = {name: TranslationEngine.translate_text(object.name), note: TranslationEngine.translate_text(object.note), question: TranslationEngine.translate_text(object.note)} | ||
end | ||
|
||
words | ||
end | ||
class CharacteristicSerializer < EligibilitySerializer | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module Export | ||
class EligibilitySerializer < ActiveModel::Serializer | ||
attributes :code, | ||
:phrases | ||
|
||
def self.collection_serialize(collection) | ||
ActiveModelSerializers::SerializableResource.new(collection, each_serializer: self) | ||
end | ||
|
||
def phrases | ||
|
||
words = {} | ||
|
||
I18n.available_locales.each do |locale| | ||
#It is not a bug that note and question are the same. In Oneclick Legacy, there is no question | ||
I18n.locale = locale | ||
words[locale] = {name: TranslationEngine.translate_text(object.name), note: TranslationEngine.translate_text(object.note), question: TranslationEngine.translate_text(object.note)} | ||
end | ||
|
||
words | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,6 @@ | ||
module Export | ||
class TripPurposeSerializer < ActiveModel::Serializer | ||
attributes :code, | ||
:phrases | ||
class TripPurposeSerializer < EligibilitySerializer | ||
|
||
def self.collection_serialize(collection) | ||
ActiveModelSerializers::SerializableResource.new(collection, each_serializer: self) | ||
end | ||
|
||
def phrases | ||
|
||
words = {} | ||
|
||
I18n.available_locales.each do |locale| | ||
#It is not a bug that note and question are the same. In Oneclick Legacy, there is no question | ||
I18n.locale = locale | ||
words[locale] = {name: TranslationEngine.translate_text(object.name), note: TranslationEngine.translate_text(object.note), question: TranslationEngine.translate_text(object.note)} | ||
end | ||
|
||
words | ||
end | ||
|
||
end | ||
end |