Cant use object in block of add_to_serializer

Hello ! I’m currently working on the Multilingual Plugin, and in the add_to_serializer method, i wish to use the &block arguements by giving a lambda, to avoid code redundancy, and to pass arguments in it

    corresponding_translation =
      -> (object, scope, translated_field_type, uncategorized_field_name, default_object_used) {
        if object.uncategorized?
          I18n.t(uncategorized_field_name, locale: I18n.locale)
        elsif !(object.slug_path && Multilingual::Translation.get(translated_field_type, default_object_used)).blank?
          Multilingual::Translation.get(translated_field_type, default_object_used)[client_locale.call(scope).to_sym] || default_object_used
        else
          default_object_used
        end
      }

add_to_serializer(
      :basic_category,
      :name,
      false,
      &block = corresponding_translation.call(object, scope, "category_name", 'uncategorized', object.name)
    )

However, when I try to run Discourse, it doesnt launch and gives me instead this error, saying that object is undefined as a local variable, however I wish to use the Discourse variable and not a local variable

<path to discourse>/plugin/discourse-multilingual/plugin.rb:228:in `block in activate!': undefined local variable or method `object' for #<Plugin::Instance:0x00007f3629ad0cf8 @assets=[["<path to discourse>/plugins/discourse-multilingual/assets/stylesheets/common/multilingual.scss", nil, "discourse-multilingual"], ["<path to discourse>/plugins/discourse-multilingual/assets/stylesheets/mobile/multilingual.scss", :mobile, "discourse-multilingual"]], @path="<path to discourse>/plugins/discourse-multilingual/plugin.rb", @enabled_site_setting=:multilingual_enabled, @directory_name="discourse-multilingual", @extra_js_file_path="<path to discourse>/app/assets/javascripts/plugins/discourse-multilingual_extra.js.erb", @color_schemes=[], @javascripts=[], @locales=[], @service_workers=[], @styles=[], @metadata=#<Plugin::Metadata:0x00007f3624f752e0 @name="discourse-multilingual", @about="Features to support multilingual forums", @version="0.2.9", @url="https://github.com/paviliondev/discourse-multilingual", @authors="Angus McLeod, Robert Barrow", @contact_emails="development@pavilion.tech">, @seed_data={}, @asset_filters=[], @idx=0, @initializers=[#<Proc:0x00007f362564b4c0 <path to discourse>/plugins/discourse-multilingual/plugin.rb:28>]> (NameError)

And when I remove it to test, it says that scope is also an undefined local variable

Do you have any advice ? ty in advance !