Module:Bangladesh Gazette/doc

Category:Module documentation#Bangladesh%20Gazette/doc

This module provides metadata handling and categorization for Bangladesh Gazette files on Wikimedia Commons. It powers the {{Bangladesh Gazette Information}} template.

Purpose

The module generates formatted information boxes for Bangladesh Gazette documents and automatically categorizes them based on gazette type, publication date, part number (for weekly gazettes), and issuing organization (for extraordinary gazettes). It supports both weekly and extraordinary gazette types with bilingual (English/Bengali) display.

Usage

This module is not intended to be invoked directly. Instead, use the {{Bangladesh Gazette Information}} template. See Template:Bangladesh Gazette Information/doc for complete usage instructions.

From template pages:

{{Bangladesh Gazette Information
|type = weekly
|date = 2025-12-04
|part = I
|source = http://www.dpp.gov.bd/...
}}

From Lua modules (if needed):

local p = require('Module:Bangladesh Gazette')
local result = p.infobox(frame)

Functions

Main functions

p.infobox(frame)
Main function that generates the complete information box with metadata and categories. This is invoked by {{Bangladesh Gazette Information}}.
Parameters: Receives a frame object with parent arguments from the template
Returns: Formatted wikitext containing the information box and category tags
p.hasInfobox(frame)
Utility function to check if the Bangladesh Gazette Information template is used on the current page.
Returns: "yes" if template is found, "no" otherwise

Internal helper functions

The module contains several internal functions that handle specific aspects of data processing:

Part normalization
normalizePart(part) – Accepts Roman numerals (I-VIII), Arabic numerals (1-8), or mixed case, and normalizes to uppercase Roman numerals
Date parsing
parseDate(dateStr) – Extracts year, month, and ISO week number from date strings
getWeekOfMonth(dateStr) – Calculates which week of the month (1-5) a date falls in
getMonthName(monthNum) – Converts month number to English month name
Number conversion
toBengaliNumber(num) – Converts English numerals to Bengali numerals (০-৯)
toEnglishNumber(num) – Converts Bengali numerals to English numerals (0-9)
getOrdinalEn(num) – Generates English ordinals (1st, 2nd, 3rd, etc.)
getOrdinalBn(num) – Generates Bengali ordinals (১ম, ২য়, ৩য়, ৪র্থ, etc.)
Categorization
getWeeklyCategories(args, pageName) – Generates categories for weekly gazettes
getExtraordinaryCategories(args, pageName) – Generates categories for extraordinary gazettes
Source detection
isDPPUrl(url) – Detects if a URL is from the Department of Printing and Publications (dpp.gov.bd)

Data structures

Part name mappings

The module maintains mappings for the eight parts of Bangladesh Weekly Gazette:

PartEnglish (Short)Bengali (Short)Category
IStatutory notificationsবিধিবদ্ধ প্রজ্ঞাপনStatutory notifications
IIGovernment appointmentsসরকারি নিয়োগGovernment appointments
IIIDefence notificationsপ্রতিরক্ষা প্রজ্ঞাপনDefence notifications
IVPatent office notificationsপেটেন্ট অফিসের প্রজ্ঞাপনPatent office notifications
VActs and Billsআইন ও বিলActs and Bills
VISupreme Court and Public Service notificationsসুপ্রিম কোর্ট ও সরকারি কর্মকমিশনের প্রজ্ঞাপনSupreme Court and Public Service notifications
VIIMiscellaneous notificationsবিবিধ অবিধিবদ্ধ প্রজ্ঞাপনMiscellaneous notifications
VIIIPrivate advertisementsব্যক্তিগত বিজ্ঞাপনPrivate advertisements

Long-form descriptions are also maintained for each part in both English and Bengali for use in the information box.

Conversion tables

  • romanToArabic – Maps Roman numerals (I-VIII, i-viii) to Arabic (1-8)
  • arabicToRoman – Maps Arabic numerals (1-8) to Roman (I-VIII)
  • monthNames – Maps month numbers (01-12) to English month names

Categorization scheme

Weekly gazettes

Files with type=weekly are categorized as:

  • Category:Bangladesh Weekly Gazette from {Year} {Part Name}

Example: Category:Bangladesh Weekly Gazette from 2025 Private advertisements

Extraordinary gazettes

Files with type=extraordinary are categorized as:

  • Category:Bangladesh Extraordinary Gazette from {Month} {Year} by {Ministry}

Example: Category:Bangladesh Extraordinary Gazette from June 2024 by Ministry of Law, Justice and Parliamentary Affairs

Error categorization

Files missing required parameters are categorized in:

  • Category:Bangladesh Gazette files needing parameters

Field order and auto-generation

The information box displays fields in this specific order:

  1. Gazette Type (always first) – Auto-generated bilingual label
  2. Description – Auto-generated from part number for weekly gazettes (overridable)
  3. Part (weekly only) – Normalized and displayed bilingually with full description
  4. Date – Publication date (required)
  5. Volume (weekly only) – ISO week number of year, auto-calculated from date (overridable)
  6. Week (weekly only) – Week of month (1-5), auto-calculated (overridable)
  7. Source – Automatically wrapped with {{Source-DPP}} if from dpp.gov.bd
  8. Organization (extraordinary only) – Ministry or issuing organization
  9. Author – Defaults to Institution:Government of Bangladesh (overridable)
  10. Page Range – Displayed bilingually in both English and Bengali numerals
  11. Permission (near end)
  12. Other Versions (always last)

Bilingual support

The module uses {{LangSwitch}}, {{En}}, and {{Bn}} templates to provide bilingual display:

  • Field labels appear in both English and Bengali based on user preference
  • Ordinal numbers use appropriate format for each language
  • Part names and descriptions are shown in both languages
  • Page ranges display in both English (0-9) and Bengali (০-৯) numerals

Examples

Weekly gazette with minimal parameters

{{#invoke:Bangladesh Gazette|infobox
|type = weekly
|date = 2025-12-04
|part = VIII
|source = http://www.dpp.gov.bd/upload_file/gazettes/59439_93575.pdf
}}

This will:

  • Auto-generate description based on Part VIII
  • Calculate volume as ISO week 49
  • Calculate week of month as 1st week
  • Default author to Government of Bangladesh
  • Categorize in "Bangladesh Weekly Gazette from 2025 Private advertisements"

Extraordinary gazette

{{#invoke:Bangladesh Gazette|infobox
|type = extraordinary
|description = Notification regarding appointment of High Court judges
|date = 2024-06-10
|ministry = Ministry of Law, Justice and Parliamentary Affairs
|source = https://dpp.gov.bd/site/page/9012
}}

This will categorize in "Bangladesh Extraordinary Gazette from June 2024 by Ministry of Law, Justice and Parliamentary Affairs"

Dependencies

This module depends on the following templates:

Technical notes

  • The module uses Lua's os.time and os.date functions for date calculations
  • ISO week numbers follow the ISO 8601 standard (week starts Monday, first week has Thursday of the year)
  • Part number validation is case-insensitive and accepts multiple formats (I, i, 1 all map to Part I)
  • Page exclusions prevent categorization of the template itself, documentation pages, and test pages
  • The module handles missing parameters gracefully by using default values or auto-calculation where possible

See also

Category:Module documentation