def create_translation_value
      batch_key = params[:batch_key]
      # batch_key might be "extra" or ..
      i18n_key = params[:i18n_key].sub(/^[.]*/, "")
      # regex above just incase there is a leading .
      full_i18n_key = batch_key.underscore.camelcase(:lower) + "." + i18n_key
      # eg propertyTypes.flat
      # subdomain = request.subdomain.downcase

      # http://stackoverflow.com/questions/5917355/find-or-create-race-conditions
      begin
        field_key = FieldKey.find_or_initialize_by(global_key: full_i18n_key)
        field_key.tag = batch_key
        field_key.save!
      rescue ActiveRecord::StatementInvalid => error
        @save_retry_count = (@save_retry_count || 5)
        retry if (@save_retry_count -= 1) > 0
        raise error
      end
      phrase = I18n::Backend::ActiveRecord::Translation.find_or_create_by(
        key: full_i18n_key,
      locale: params[:locale]
)
      phrase.value = params[:i18n_value]
      if phrase.save!
        I18n.backend.reload!
        return render json: { success: true }
      else
        return render json: { error: "unable to create phrase" }
      end
    end
def create_translation_value
      batch_key = params[:batch_key]
      # batch_key might be "extra" or ..
      i18n_key = params[:i18n_key].sub(/^[.]*/, "")
      # regex above just incase there is a leading .
      full_i18n_key = batch_key.underscore.camelcase(:lower) + "." + i18n_key
      # eg propertyTypes.flat
      # subdomain = request.subdomain.downcase

      # http://stackoverflow.com/questions/5917355/find-or-create-race-conditions
      begin
        field_key = FieldKey.find_or_initialize_by(global_key: full_i18n_key)
        field_key.tag = batch_key
        field_key.save!
      rescue ActiveRecord::StatementInvalid => error
        @save_retry_count = (@save_retry_count || 5)
        retry if (@save_retry_count -= 1) > 0
        raise error
      end
      phrase = I18n::Backend::ActiveRecord::Translation.find_or_create_by(
        key: full_i18n_key,
      locale: params[:locale]
)
      phrase.value = params[:i18n_value]
      if phrase.save!
        I18n.backend.reload!
        return render json: { success: true }
      else
        return render json: { error: "unable to create phrase" }
      end
    end
# below called for completely new set of translations