ruby-i18n / ruby-i18n/ruby-cldr

Add SubdivisionContainment

Open
#181 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
78
Forks
18
Avg merge
9d 8h
Merged PRs (30d)
3

Description

Hey there, thanks for this great plugin. Just cam across the use case to need to subdivisionContainment. Easy access through the gem would be great.

e.g.:

module Cldr
  module Export
    module Data
      class SubdivisionsContainment < Base
        def initialize(*)
          super(nil)
          update(subdivision_containment: subdivision_containment)
        end

        def subdivision_containment
          @subdivision_containment ||= doc.xpath("supplementalData/subdivisionContainment/subgroup").each_with_object(
            Hash.new { |h, k| h[k] = { contains: [] } }
          ) do |territory, memo|
            territory_id = territory.attribute("type").value
            children = territory.attribute("contains").value.split(" ")

            memo[territory_id][:contains].concat(children)
            memo[territory_id][:contains].sort!
          end
        end
      end
    end
  end
end 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing Cldr::Export::Data classes and how the gem exposes exported data. Then inspect the CLDR supplementalData/subdivisionContainment/subgroup path and the proposed SubdivisionsContainment class in the issue. Done means subdivision containment is accessible through the gem and its behavior is covered by the project's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.