Skip to content

feat: percentage calculator in Turkish - #27

Merged
halitsever merged 1 commit into
mainfrom
feat/yuzde-hesaplama
Dec 2, 2026
Merged

halitsever merged 1 commit into
mainfrom
feat/yuzde-hesaplama

Conversation

@halitsever

Copy link
Copy Markdown
Owner

Adds /tr/yuzde-hesaplama/, a Turkish-only percentage page. It opens with the formula, then has five calculators stacked in one panel: a percentage of a number, what percent one number is of another, percent increase or decrease, a discounted or raised price, and the price before a discount or rise. Under each result the formula is written out with the user's numbers.

Why: Semrush TR (2 Dec 2026), Keyword Overview:

Keyword Volume KD
yüzde hesaplama 450,000 36
basit yüzde hesaplama 6,600 31
yüzde hesaplama nasıl yapılır 5,400 26
yüzde hesaplama formülü 3,600 26
yüzde artış hesaplama 2,900 22

Top 10 for the head term: milliyet uzmanpara (AS 95), yuzde.hesaplama.net (63), balpdijital (36), kargopek (15), getmidas (64), YouTube, hurriyet (98), hesapkurdu (62), ikas blog (43), bloomberght (71). kargopek (AS 15) and balpdijital (AS 36) sit at 3 to 5 for every variant, so a clean tool with a clear formula has a way in. There's no EN page because English searchers already have strong percentage calculators. The EN index links to the Turkish page with a badge, the same way it does for KDV.

How it works:

  • src/sayi.js does exact decimal math on BigInt fractions. It reads Turkish input (1.250,75, -12,5) and English input (1,234.56). A lone dot counts as a thousands dot only before exactly three digits. It handles spaces, the Unicode minus and % signs. Only the displayed result is rounded, half away from zero, to the chosen number of decimals (0 to 4, default 2). When rounding drops digits, the formula shows ≈ and says so. Output uses Intl.NumberFormat('tr-TR').
  • src/yuzde.js covers the five modes. Division by zero, negative prices, discounts over 100% and working back from a 100% discount each return an error code, and the page shows each one as a sentence. Percent change divides by the absolute value of a negative start value, and the page says so whenever that applies.
  • Only the decimals setting and the discount/rise choices go to localStorage. Typed numbers are never stored. The CSP is unchanged.
  • The page and its three scripts are in the service worker precache (npm run check:pwa passes). There's a new browser-check block, and the index check now expects 18 tools. The social image is public/og/yuzde-hesaplama.png.
  • The Excel FAQ uses the examples from Microsoft's Turkish help page, which is linked.

Checked: npm test (196 pass), npm run check:pwa, and the new browser-check block plus the index/404 pages at 1440 and 390 px (the full npm run check times out at the text repeater step on this machine).

@halitsever
halitsever merged commit c4bfc2f into main Dec 2, 2026
2 checks passed
@halitsever
halitsever deleted the feat/yuzde-hesaplama branch December 2, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant