nanakshahi 0.2.0.1 → 0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4d16cf644cdb08a9b0133ec2a7604691a39a7a1de9ae7c04938f71ec5dc7e83
4
- data.tar.gz: fcf9406d0425d71278698b31b2b88c0b074c8a1ee516e5ac381bb672870adc52
3
+ metadata.gz: 6d6f1860020f496e46759bfbf773e907511eef5349cd1386fd305473bbfca0c2
4
+ data.tar.gz: 348c4f90184c307f2ba3d7eba2867dbdd089288285eb5fd2761f42a6be631096
5
5
  SHA512:
6
- metadata.gz: d16dcee496705ee6a622e056f028d86348d7ae0da31e2ae10f82f5357b5cc7e8d53365c641156432a6ddef0a5fdf689be98ac503d8e4449a90e554903a44eaf5
7
- data.tar.gz: 43471634300cb517fd94ea0ad556f03f3aaeec5cb7e61a9efc679d8298992d9b2d3ebe153e2b62a7f4e434bdea00c2acfaa7b6303b7974bfb63cc5da5bdbf4a9
6
+ metadata.gz: e9c95621d31dc09b969aa75a7d32e843094e13388e2ef66d8f790065621958abc0899456b26d62c2fae2f8ccaa4ab63a3bc93a7d3ca5f86cf72e80d101b12f7a
7
+ data.tar.gz: ec63fb3edd2a44f293943e2eb754872483282e2eee3a80dc67e2990528959f527ab77a94d6836d4ff4b9b090e72911110aa0a9c7f58a372731946748fae6e98b
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
1
  # coding: UTF-8
2
+ === 0.3 / 2021-09-20
3
+
4
+ Features:
5
+
6
+ - Now supports Shahmukhi Script of Panjabi language via `to_shahmukhi` method
7
+
8
+ Bug fixes:
9
+ - Fixed a bug which returned incorrect `to_gregorian method`
10
+
2
11
  === 0.2.0 / 2021-09-12
3
12
 
4
13
  Bug fixes:
@@ -0,0 +1,34 @@
1
+ pa_PK:
2
+ nanakshahi_months:
3
+ -
4
+ - چیت
5
+ - وساکھ
6
+ - جیٹھ
7
+ - ہاڑھ
8
+ - ساؤݨ
9
+ - بھادوں
10
+ - اسو
11
+ - کتک
12
+ - مگھر
13
+ - پوہ
14
+ - ماگھ
15
+ - پھگݨ
16
+ digits:
17
+ - ۰
18
+ - ۱
19
+ - ۲
20
+ - ۳
21
+ - ۴
22
+ - ۵
23
+ - ۶
24
+ - ۷
25
+ - ۸
26
+ - ۹
27
+ day_names:
28
+ - سوم وار
29
+ - منگل
30
+ - بدھ
31
+ - جمعرات
32
+ - شکروار
33
+ - سن
34
+ - اتوار
@@ -1,3 +1,3 @@
1
1
  class Nanakshahi
2
- VERSION = "0.2.0.1"
2
+ VERSION = "0.3"
3
3
  end
data/lib/nanakshahi.rb CHANGED
@@ -15,7 +15,7 @@ require "nanakshahi/gurpurab"
15
15
  # @attr_reader [Integer] day Day part of Nanakshahi date object
16
16
  class Nanakshahi
17
17
  I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
18
- I18n.available_locales = [:en, :pa]
18
+ I18n.available_locales = [:en, :pa, :pa_PK]
19
19
  include Comparable
20
20
  extend Utils
21
21
  extend Grid
@@ -63,6 +63,14 @@ class Nanakshahi
63
63
  "#{panjabi_numerals(day)} #{I18n.t(:nanakshahi_months, locale: :pa)[month]}, #{panjabi_numerals(year_zero_correction(year))} #{era}"
64
64
  end
65
65
 
66
+ # Shahmukhi String representation of Nanakshahi object
67
+ #
68
+ # @return [String] Shahmukhi String representation of Nanakshahi
69
+ def to_shahmukhi
70
+ era = year < 1 ? :دھندکال : :نانکشاھی
71
+ "#{shahmukhi_numerals(day)} #{I18n.t(:nanakshahi_months, locale: :pa_PK)[month]} #{shahmukhi_numerals(year_zero_correction(year))} #{era} "
72
+ end
73
+
66
74
  # Checks Nanakshahi leap year
67
75
  #
68
76
  # @return [Boolean] True if Nanakshahi year's Phagun has 31 days
@@ -149,4 +157,13 @@ class Nanakshahi
149
157
  def panjabi_numerals(number)
150
158
  number.to_s.chars.map { |digit| I18n.t(:digits, locale: :pa)[digit.to_i] }.join
151
159
  end
160
+
161
+ # Converts english numerals to Shahmukhi
162
+ #
163
+ # @param [Integer] number A numeric usually date
164
+ # @return [String] Shahmukhi representation of date
165
+ # @private
166
+ def shahmukhi_numerals(number)
167
+ number.to_s.chars.map { |digit| I18n.t(:digits, locale: :pa_PK)[digit.to_i] }.join
168
+ end
152
169
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanakshahi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvinder Singh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-19 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,7 @@ files:
94
94
  - bin/setup
95
95
  - config/locales/en.yml
96
96
  - config/locales/pa.yml
97
+ - config/locales/pa_PK.yml
97
98
  - lib/nanakshahi.rb
98
99
  - lib/nanakshahi/date.rb
99
100
  - lib/nanakshahi/grid.rb