From fcf10e3305dc06cfa83612653eede6a21af12db2 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Mon, 13 Jan 2025 19:56:47 -0800 Subject: [PATCH 1/2] Upgrade i18next --- config/i18n.json | 138 ++++++++++++++++++------------------- i18next-scanner.config.cjs | 1 + package.json | 4 +- pnpm-lock.yaml | 26 +++++-- src/app/i18n.ts | 3 +- src/locale/en.json | 136 ++++++++++++++++++------------------ src/testing/test-utils.ts | 3 +- 7 files changed, 161 insertions(+), 150 deletions(-) diff --git a/config/i18n.json b/config/i18n.json index acce19d412..6512994ac4 100644 --- a/config/i18n.json +++ b/config/i18n.json @@ -31,10 +31,10 @@ "Armory": { "Armory": "Armory", "OpenInArmory": "view in Armory", - "WishlistedRolls": "Wishlisted Roll", - "WishlistedRolls_plural": "{{count, number}} Wishlisted Rolls", - "TrashlistedRolls": "Trashlisted Roll", - "TrashlistedRolls_plural": "{{count, number}} Trashlisted Rolls", + "WishlistedRolls_one": "Wishlisted Roll", + "WishlistedRolls_other": "{{count, number}} Wishlisted Rolls", + "TrashlistedRolls_one": "Trashlisted Roll", + "TrashlistedRolls_other": "{{count, number}} Trashlisted Rolls", "NoNotes": "No Notes", "YourItems": "Your Items", "Unknown": "Unknown Item", @@ -59,8 +59,8 @@ "Weapons": "Weapons" }, "BulkNote": { - "Title": "Change notes for 1 item", - "Title_plural": "Change notes for {{count}} items", + "Title_one": "Change notes for 1 item", + "Title_other": "Change notes for {{count}} items", "Replace": "Replace notes", "Append": "Append to notes / add #hashtags", "Remove": "Remove from notes / remove #hashtags", @@ -114,17 +114,17 @@ "Super": "Super cooldown: {{cooldown}}" }, "Countdown": { - "Days": "1 Day", - "Days_compact": "{{count}}d", - "Days_compact_plural": "{{count}}d", - "Days_plural": "{{count}} Days" + "Days_one": "1 Day", + "Days_compact_one": "{{count}}d", + "Days_compact_other": "{{count}}d", + "Days_other": "{{count}} Days" }, "Csv": { "EmptyFile": "There were no rows in the file.", "ImportConfirm": "Are you sure you want to import tags/notes from CSV? This will overwrite tags/notes for all items contained in your spreadsheet.", "ImportFailed": "Failed to import tags/notes from CSV: {{error}}", - "ImportSuccess": "Tags/notes loaded for one item.", - "ImportSuccess_plural": "Tags/notes loaded for {{count}} items.", + "ImportSuccess_one": "Tags/notes loaded for one item.", + "ImportSuccess_other": "Tags/notes loaded for {{count}} items.", "ImportWrongFileType": "File is not a CSV file.", "WrongFields": "CSV must have 'Id', 'Notes', 'Tag', and 'Hash' columns." }, @@ -151,18 +151,18 @@ }, "FarmingMode": { "Vault": "It will move items to the vault to make room.", - "D2Desc": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", - "D2Desc_female": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", - "D2Desc_male": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", - "D2Desc_plural": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", - "D2Desc_female_plural": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", - "D2Desc_male_plural": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", - "Desc": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", - "Desc_female": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", - "Desc_male": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", - "Desc_plural": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", - "Desc_female_plural": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", - "Desc_male_plural": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", + "D2Desc_one": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", + "D2Desc_female_one": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", + "D2Desc_male_one": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", + "D2Desc_other": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", + "D2Desc_female_other": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", + "D2Desc_male_other": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", + "Desc_one": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", + "Desc_female_one": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", + "Desc_male_one": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", + "Desc_other": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", + "Desc_female_other": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", + "Desc_male_other": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", "FarmingMode": "Farming Mode", "FarmingModeNote": "(maintain space for drops)", "MakeRoom": { @@ -216,12 +216,12 @@ "Ascended": "Shows items that have an ascend node which have been ascended.", "Unascended": "Shows items that have an ascend node which have not been ascended.", "Breaker": "Filter by breaker type or corresponding champion type. breaker:instrinsic shows items with intrinsic breaker ability.", - "BulkClear": "Removed tag from 1 item.", - "BulkClear_plural": "Removed tags from {{count}} items.", - "BulkRevert": "Reverted tag on 1 item.", - "BulkRevert_plural": "Reverted tags on {{count}} items.", - "BulkTag": "Tagged selected item as {{tag}}.", - "BulkTag_plural": "Tagged {{count}} selected items as {{tag}}.", + "BulkClear_one": "Removed tag from 1 item.", + "BulkClear_other": "Removed tags from {{count}} items.", + "BulkRevert_one": "Reverted tag on 1 item.", + "BulkRevert_other": "Reverted tags on {{count}} items.", + "BulkTag_one": "Tagged selected item as {{tag}}.", + "BulkTag_other": "Tagged {{count}} selected items as {{tag}}.", "Catalyst": "Shows catalysts based on their status. catalyst:complete shows catalysts you have completed and applied, catalyst:incomplete shows catalysts you have unlocked but either not completed the objective or applied the catalyst, and catalyst:missing shows items that can have a catalyst but you haven't found it yet.", "Class": "Shows items based on their class affinity.", "Combine": "Filters can be combined or grouped with parentheses, \"or\" and \"and\" to narrow down your search, for example \"{{example}}\".", @@ -390,8 +390,8 @@ "FilterHelpProgress": "Search milestones and bounties", "FilterHelpOptimizer": "Select armor to be considered for loadouts: {{example}}", "FilterHelpLoadouts": "Search loadout names and notes", - "FilterMatchCount": "1 item", - "FilterMatchCount_plural": "{{count}} items", + "FilterMatchCount_one": "1 item", + "FilterMatchCount_other": "{{count}} items", "Filters": "Filters", "FilterHelpMenuItem": "Filters Help...", "LaunchDIMAlone": "Separate Window", @@ -753,12 +753,12 @@ "LoadoutParametersQuery": "Items must match this search filter", "LoadoutParametersStats": "Stat priorities and minimum/maximum stat tiers", "MakeRoom": "Make Room for Postmaster", - "MakeRoomDone": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", - "MakeRoomDone_female": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", - "MakeRoomDone_male": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", - "MakeRoomDone_plural": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", - "MakeRoomDone_female_plural": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", - "MakeRoomDone_male_plural": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", + "MakeRoomDone_one": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", + "MakeRoomDone_female_one": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", + "MakeRoomDone_male_one": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", + "MakeRoomDone_other": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", + "MakeRoomDone_female_other": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", + "MakeRoomDone_male_other": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", "MakeRoomError": "Unable to make room for all Postmaster items: {{error}}.", "ManageLoadouts": "Manage Loadouts", "MaxSlots": "You can only have {{slots}} {{bucketName}} in a loadout.", @@ -767,12 +767,12 @@ "MaximizeStat": "Maximize Stat", "ModPlacement": { "InvalidMods": "Invalid Mods", - "InvalidModsDesc": "1 mod cannot fit into any armor piece.", - "InvalidModsDesc_plural": "{{count}} mods cannot fit into any armor piece.", + "InvalidModsDesc_one": "1 mod cannot fit into any armor piece.", + "InvalidModsDesc_other": "{{count}} mods cannot fit into any armor piece.", "ModPlacement": "Mod Placement", "UnassignedMods": "Unassigned Mods", - "UnassignedModsDesc": "1 mod did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", - "UnassignedModsDesc_plural": "{{count}} mods did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", + "UnassignedModsDesc_one": "1 mod did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", + "UnassignedModsDesc_other": "{{count}} mods did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", "UpgradeCosts": "Upgrade Costs", "UpgradeCostsDesc": "Some armor needs energy capacity upgrades to fit the requested mods. In total, these upgrades cost:", "UnstackableMod": "Not Stackable", @@ -780,10 +780,10 @@ }, "MissingItemsWarning": "Some of the items in this loadout are no longer in your inventory.", "MissingItems": "Missing Items", - "ModErrorSummary": "1 mod error:", - "ModErrorSummary_plural": "{{count}} mod errors:", - "ItemErrorSummary": "1 item error:", - "ItemErrorSummary_plural": "{{count}} item errors:", + "ModErrorSummary_one": "1 mod error:", + "ModErrorSummary_other": "{{count}} mod errors:", + "ItemErrorSummary_one": "1 item error:", + "ItemErrorSummary_other": "{{count}} item errors:", "Mods": "Mods", "NoneMatch": "None of your loadouts matched the filters.", "NotesPlaceholder": "Write some notes about this loadout, or use #hashtags to categorize it", @@ -795,12 +795,12 @@ "PickArmor": "Pick Armor", "PickMods": "Add armor mods", "PullFromPostmaster": "Collect Postmaster", - "PullFromPostmasterNotification": "Pulling 1 Postmaster item to {{store}}.", - "PullFromPostmasterNotification_female": "Pulling 1 Postmaster item to {{store}}.", - "PullFromPostmasterNotification_male": "Pulling 1 Postmaster item to {{store}}.", - "PullFromPostmasterNotification_plural": "Pulling {{count}} Postmaster items to {{store}}.", - "PullFromPostmasterNotification_female_plural": "Pulling {{count}} Postmaster items to {{store}}.", - "PullFromPostmasterNotification_male_plural": "Pulling {{count}} Postmaster items to {{store}}.", + "PullFromPostmasterNotification_one": "Pulling 1 Postmaster item to {{store}}.", + "PullFromPostmasterNotification_female_one": "Pulling 1 Postmaster item to {{store}}.", + "PullFromPostmasterNotification_male_one": "Pulling 1 Postmaster item to {{store}}.", + "PullFromPostmasterNotification_other": "Pulling {{count}} Postmaster items to {{store}}.", + "PullFromPostmasterNotification_female_other": "Pulling {{count}} Postmaster items to {{store}}.", + "PullFromPostmasterNotification_male_other": "Pulling {{count}} Postmaster items to {{store}}.", "PullFromPostmasterError": "Unable to pull from Postmaster: {{error}}.", "PullFromPostmasterGeneralError": "Unable to pull all items from Postmaster.", "PullFromPostmasterPopupTitle": "Pull from Postmaster", @@ -846,10 +846,10 @@ "CopyButton": "Copy Link", "NativeShare": "Share Link", "Summary": "Share this loadout containing:", - "NumItems": "{{count}} item - recipients will be prompted to select a comparable item from their inventory", - "NumItems_plural": "{{count}} items - recipients will be prompted to select comparable items from their inventory", - "NumMods": "{{count}} mod", - "NumMods_plural": "{{count}} mods", + "NumItems_one": "{{count}} item - recipients will be prompted to select a comparable item from their inventory", + "NumItems_other": "{{count}} items - recipients will be prompted to select comparable items from their inventory", + "NumMods_one": "{{count}} mod", + "NumMods_other": "{{count}} mods", "Fashion": "Fashion (shaders & ornaments)", "Subclass": "Subclass customization", "LoadoutOptimizer": "Loadout Optimizer settings", @@ -1112,8 +1112,8 @@ "PaleHeartPathfinder": "Pale Heart Pathfinder", "PercentPrestige": "{{pct}}% to reset", "PercentMax": "{{pct}}% to maximum", - "PointsUsed": "1 point used", - "PointsUsed_plural": "{{count}} points used", + "PointsUsed_one": "1 point used", + "PointsUsed_other": "{{count}} points used", "PowerBonusHeader": "+{{powerBonus}} Power Rewards", "PowerBonusHeaderUndefined": "Other Rewards", "Progress": "Progress", @@ -1122,8 +1122,8 @@ "Quests": "Quests", "Rank": "{{name}} {{rank}}", "RecordValue": "{{value}}pts", - "Resets": "1 reset", - "Resets_plural": "{{count}} resets", + "Resets_one": "1 reset", + "Resets_other": "{{count}} resets", "GambitPathfinder": "Gambit Pathfinder", "CruciblePathfinder": "Crucible Pathfinder", "VanguardPathfinder": "Vanguard Pathfinder", @@ -1230,8 +1230,8 @@ "SortByWeaponElement": "Damage Type", "SortCustom": "Custom Sort", "SortName": "Name", - "SpacesSize": "{{count}} space", - "SpacesSize_plural": "{{count}} spaces", + "SpacesSize_one": "{{count}} space", + "SpacesSize_other": "{{count}} spaces", "Theme": "Theme", "VaultGroupingNone": "None", "WishlistRefreshNotificationBody": "If you do not see any updates, be sure the source (such as GitHub) reflects them!", @@ -1325,9 +1325,9 @@ "DimApiFinePrint": "DIM will save your tags, loadouts, and settings to the DIM servers and sync them between different versions of DIM.", "DimSyncEnabled": "DIM Sync Enabled", "DimSyncDown": "DIM Sync is not connected due to a problem talking to the server.", - "UpdateQueueLength": "{{count}} new change will be saved when we can reconnect.", + "UpdateQueueLength_one": "{{count}} new change will be saved when we can reconnect.", "DimSyncNotEnabled": "DIM Sync is not enabled, so your settings, tags, loadouts, and searches are only stored locally and will be lost if you clear your browser storage. Enable DIM Sync in Settings to back up your data automatically, or regularly back up your data manually.", - "UpdateQueueLength_plural": "{{count}} new changes will be saved when we can reconnect.", + "UpdateQueueLength_other": "{{count}} new changes will be saved when we can reconnect.", "EnableDimApi": "Enable DIM Sync (recommended)", "Export": "Download Data Backup", "ExportError": "Failed to download backup from DIM Sync", @@ -1495,10 +1495,10 @@ } }, "WishListRoll": { - "BestRatedTip": "This perk exactly matches a weapon roll on your wishlist.", - "BestRatedTip_plural": "These perks exactly match a weapon roll on your wishlist.", - "WorstRatedTip": "This perk exactly matches a weapon roll on your trashlist.", - "WorstRatedTip_plural": "These perks exactly match a weapon roll on your trashlist.", + "BestRatedTip_one": "This perk exactly matches a weapon roll on your wishlist.", + "BestRatedTip_other": "These perks exactly match a weapon roll on your wishlist.", + "WorstRatedTip_one": "This perk exactly matches a weapon roll on your trashlist.", + "WorstRatedTip_other": "These perks exactly match a weapon roll on your trashlist.", "Clear": "Clear Wish List", "ExternalSource": "Add another wish list", "ExternalSourcePlaceholder": "Paste wish list URL here", @@ -1525,4 +1525,4 @@ }, "wrong-level": "wrong-level", "no-space": "no-space" -} +} \ No newline at end of file diff --git a/i18next-scanner.config.cjs b/i18next-scanner.config.cjs index a60563ecdc..255a8e71eb 100644 --- a/i18next-scanner.config.cjs +++ b/i18next-scanner.config.cjs @@ -6,6 +6,7 @@ module.exports = { input: ['src/app/**/*.{js,jsx,ts,tsx,cjs,mjs,cts,mts}', 'src/browsercheck.js'], output: './', options: { + compatibilityJSON: 'v4', debug: false, removeUnusedKeys: true, sort: true, diff --git a/package.json b/package.json index 249c728f41..788c30d051 100644 --- a/package.json +++ b/package.json @@ -215,8 +215,8 @@ "downshift": "^9.0.8", "es-toolkit": "^1.31.0", "fast-equals": "^5.0.1", - "i18next": "^23.16.8", - "i18next-http-backend": "^2.7.1", + "i18next": "^24.2.1", + "i18next-http-backend": "^3.0.1", "immer": "^10.1.1", "memoize-one": "^6.0.0", "motion": "^11.15.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e91994b1c7..9ceba3e6f6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,11 +84,11 @@ dependencies: specifier: ^5.0.1 version: 5.0.1 i18next: - specifier: ^23.16.8 - version: 23.16.8 + specifier: ^24.2.1 + version: 24.2.1(typescript@5.7.2) i18next-http-backend: - specifier: ^2.7.1 - version: 2.7.1 + specifier: ^3.0.1 + version: 3.0.1 immer: specifier: ^10.1.1 version: 10.1.1 @@ -8808,8 +8808,8 @@ packages: engines: {node: '>=10.18'} dev: true - /i18next-http-backend@2.7.1: - resolution: {integrity: sha512-vPksHIckysGgykCD8JwCr2YsJEml9Cyw+Yu2wtb4fQ7xIn9RH/hkUDh5UkwnIzb0kSL4SJ30Ab/sCInhQxbCgg==} + /i18next-http-backend@3.0.1: + resolution: {integrity: sha512-XT2lYSkbAtDE55c6m7CtKxxrsfuRQO3rUfHzj8ZyRtY9CkIX3aRGwXGTkUhpGWce+J8n7sfu3J0f2wTzo7Lw0A==} dependencies: cross-fetch: 4.0.0 transitivePeerDependencies: @@ -8846,6 +8846,19 @@ packages: resolution: {integrity: sha512-06r/TitrM88Mg5FdUXAKL96dJMzgqLE5dv3ryBAra4KCwD9mJ4ndOTS95ZuymIGoE+2hzfdaMak2X11/es7ZWg==} dependencies: '@babel/runtime': 7.26.0 + dev: true + + /i18next@24.2.1(typescript@5.7.2): + resolution: {integrity: sha512-Q2wC1TjWcSikn1VAJg13UGIjc+okpFxQTxjVAymOnSA3RpttBQNMPf2ovcgoFVsV4QNxTfNZMAxorXZXsk4fBA==} + peerDependencies: + typescript: ^5 + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@babel/runtime': 7.26.0 + typescript: 5.7.2 + dev: false /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} @@ -13699,7 +13712,6 @@ packages: resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} hasBin: true - dev: true /ua-parser-js@1.0.39: resolution: {integrity: sha512-k24RCVWlEcjkdOxYmVJgeD/0a1TiSpqLg+ZalVGV9lsnr4yqu0w7tX/x2xX6G4zpkgQnRf89lxuZ1wsbjXM8lw==} diff --git a/src/app/i18n.ts b/src/app/i18n.ts index e9af57a4d7..117101e52c 100644 --- a/src/app/i18n.ts +++ b/src/app/i18n.ts @@ -85,8 +85,7 @@ export function initi18n(): Promise { // See https://github.com/i18next/i18next i18next.use(HttpApi).init( { - initImmediate: true, - compatibilityJSON: 'v3', + initAsync: true, debug: false, lng: lang, fallbackLng: 'en', diff --git a/src/locale/en.json b/src/locale/en.json index dd2288b1f8..1c74b6fffd 100644 --- a/src/locale/en.json +++ b/src/locale/en.json @@ -32,11 +32,11 @@ "NoNotes": "No Notes", "OpenInArmory": "view in Armory", "Season": "Season {{season}}, Year {{year}}", - "TrashlistedRolls": "Trashlisted Roll", - "TrashlistedRolls_plural": "{{count, number}} Trashlisted Rolls", + "TrashlistedRolls_one": "Trashlisted Roll", + "TrashlistedRolls_other": "{{count, number}} Trashlisted Rolls", "Unknown": "Unknown Item", - "WishlistedRolls": "Wishlisted Roll", - "WishlistedRolls_plural": "{{count, number}} Wishlisted Rolls", + "WishlistedRolls_one": "Wishlisted Roll", + "WishlistedRolls_other": "{{count, number}} Wishlisted Rolls", "YourItems": "Your Items" }, "Browsercheck": { @@ -62,8 +62,8 @@ "Confirm": "Update Notes", "Remove": "Remove from notes / remove #hashtags", "Replace": "Replace notes", - "Title": "Change notes for 1 item", - "Title_plural": "Change notes for {{count}} items" + "Title_one": "Change notes for 1 item", + "Title_other": "Change notes for {{count}} items" }, "BungieAlert": { "Title": "A message from Bungie:" @@ -113,17 +113,17 @@ "Super": "Super cooldown: {{cooldown}}" }, "Countdown": { - "Days": "1 Day", - "Days_compact": "{{count}}d", - "Days_compact_plural": "{{count}}d", - "Days_plural": "{{count}} Days" + "Days_compact_one": "{{count}}d", + "Days_compact_other": "{{count}}d", + "Days_one": "1 Day", + "Days_other": "{{count}} Days" }, "Csv": { "EmptyFile": "There were no rows in the file.", "ImportConfirm": "Are you sure you want to import tags/notes from CSV? This will overwrite tags/notes for all items contained in your spreadsheet.", "ImportFailed": "Failed to import tags/notes from CSV: {{error}}", - "ImportSuccess": "Tags/notes loaded for one item.", - "ImportSuccess_plural": "Tags/notes loaded for {{count}} items.", + "ImportSuccess_one": "Tags/notes loaded for one item.", + "ImportSuccess_other": "Tags/notes loaded for {{count}} items.", "ImportWrongFileType": "File is not a CSV file.", "WrongFields": "CSV must have 'Id', 'Notes', 'Tag', and 'Hash' columns." }, @@ -149,18 +149,18 @@ "Troubleshooting": "Troubleshooting Guide" }, "FarmingMode": { - "D2Desc": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", - "D2Desc_female": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", - "D2Desc_female_plural": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", - "D2Desc_male": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", - "D2Desc_male_plural": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", - "D2Desc_plural": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", - "Desc": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", - "Desc_female": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", - "Desc_female_plural": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", - "Desc_male": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", - "Desc_male_plural": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", - "Desc_plural": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", + "D2Desc_female_one": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", + "D2Desc_female_other": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", + "D2Desc_male_one": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", + "D2Desc_male_other": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", + "D2Desc_one": "DIM is preventing items from going to the Postmaster by making sure there's always one empty space per item type on {{store}}.", + "D2Desc_other": "DIM is preventing items from going to the Postmaster by making sure there's always {{count}} empty spaces per item type on {{store}}.", + "Desc_female_one": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", + "Desc_female_other": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", + "Desc_male_one": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", + "Desc_male_other": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", + "Desc_one": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping one empty space open per item type to prevent anything from going to the Postmaster.", + "Desc_other": "DIM is moving Engram and Glimmer items from {{store}} to the vault and keeping {{count}} spaces open per item type to prevent anything from going to the Postmaster.", "FarmingMode": "Farming Mode", "FarmingModeNote": "(maintain space for drops)", "MakeRoom": { @@ -204,12 +204,12 @@ "ArmorIntrinsic": "Shows legendary armor which has an intrinsic perk, such as Artifice Armor.", "Ascended": "Shows items that have an ascend node which have been ascended.", "Breaker": "Filter by breaker type or corresponding champion type. breaker:instrinsic shows items with intrinsic breaker ability.", - "BulkClear": "Removed tag from 1 item.", - "BulkClear_plural": "Removed tags from {{count}} items.", - "BulkRevert": "Reverted tag on 1 item.", - "BulkRevert_plural": "Reverted tags on {{count}} items.", - "BulkTag": "Tagged selected item as {{tag}}.", - "BulkTag_plural": "Tagged {{count}} selected items as {{tag}}.", + "BulkClear_one": "Removed tag from 1 item.", + "BulkClear_other": "Removed tags from {{count}} items.", + "BulkRevert_one": "Reverted tag on 1 item.", + "BulkRevert_other": "Reverted tags on {{count}} items.", + "BulkTag_one": "Tagged selected item as {{tag}}.", + "BulkTag_other": "Tagged {{count}} selected items as {{tag}}.", "Catalyst": "Shows catalysts based on their status. catalyst:complete shows catalysts you have completed and applied, catalyst:incomplete shows catalysts you have unlocked but either not completed the objective or applied the catalyst, and catalyst:missing shows items that can have a catalyst but you haven't found it yet.", "Class": "Shows items based on their class affinity.", "Combine": "Filters can be combined or grouped with parentheses, \"or\" and \"and\" to narrow down your search, for example \"{{example}}\".", @@ -378,8 +378,8 @@ "FilterHelpOptimizer": "Select armor to be considered for loadouts: {{example}}", "FilterHelpProgress": "Search milestones and bounties", "FilterHelpRecords": "Search triumphs and collections", - "FilterMatchCount": "1 item", - "FilterMatchCount_plural": "{{count}} items", + "FilterMatchCount_one": "1 item", + "FilterMatchCount_other": "{{count}} items", "Filters": "Filters", "InstallDIM": "Install as an App", "InstallDIMBanner": "Install DIM as an app on your home screen", @@ -798,8 +798,8 @@ "InGameLoadouts": "In-Game Loadouts", "IncludeRuntimeStatBenefits": "Include Font mod stats", "IncludeRuntimeStatBenefitsDesc": "\"Font of ...\" armor mods provide a flat boost to character stats while you have Armor Charges.\n\nWith this setting, DIM considers these mods active and adds their benefits to this Loadout's stats in calculations and optimizations.", - "ItemErrorSummary": "1 item error:", - "ItemErrorSummary_plural": "{{count}} item errors:", + "ItemErrorSummary_one": "1 item error:", + "ItemErrorSummary_other": "{{count}} item errors:", "ItemLeveling": "Item Leveling", "LoadoutName": "Loadout name", "LoadoutParameters": "Loadout Optimizer settings", @@ -808,12 +808,12 @@ "LoadoutParametersStats": "Stat priorities and minimum/maximum stat tiers", "Loadouts": "Loadouts", "MakeRoom": "Make Room for Postmaster", - "MakeRoomDone": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", - "MakeRoomDone_female": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", - "MakeRoomDone_female_plural": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", - "MakeRoomDone_male": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", - "MakeRoomDone_male_plural": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", - "MakeRoomDone_plural": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", + "MakeRoomDone_female_one": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", + "MakeRoomDone_female_other": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", + "MakeRoomDone_male_one": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", + "MakeRoomDone_male_other": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", + "MakeRoomDone_one": "Finished making room for 1 Postmaster item by moving 1 item off of {{store}}.", + "MakeRoomDone_other": "Finished making room for {{count}} Postmaster items by moving {{movedNum}} items off of {{store}}.", "MakeRoomError": "Unable to make room for all Postmaster items: {{error}}.", "ManageLoadouts": "Manage Loadouts", "MaxSlots": "You can only have {{slots}} {{bucketName}} in a loadout.", @@ -821,17 +821,17 @@ "MaximizePower": "Max Power", "MaximizeStat": "Maximize Stat", "MissingItemsWarning": "Some of the items in this loadout are no longer in your inventory.", - "ModErrorSummary": "1 mod error:", - "ModErrorSummary_plural": "{{count}} mod errors:", + "ModErrorSummary_one": "1 mod error:", + "ModErrorSummary_other": "{{count}} mod errors:", "ModPlacement": { "InvalidMods": "Invalid Mods", - "InvalidModsDesc": "1 mod cannot fit into any armor piece.", - "InvalidModsDesc_plural": "{{count}} mods cannot fit into any armor piece.", + "InvalidModsDesc_one": "1 mod cannot fit into any armor piece.", + "InvalidModsDesc_other": "{{count}} mods cannot fit into any armor piece.", "ModPlacement": "Mod Placement", "StackableMod": "Stackable", "UnassignedMods": "Unassigned Mods", - "UnassignedModsDesc": "1 mod did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", - "UnassignedModsDesc_plural": "{{count}} mods did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", + "UnassignedModsDesc_one": "1 mod did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", + "UnassignedModsDesc_other": "{{count}} mods did not fit due to insufficient energy capacity or mod slots. Energy upgrades to the selected armor will not fix the issue.", "UnstackableMod": "Not Stackable", "UpgradeCosts": "Upgrade Costs", "UpgradeCostsDesc": "Some armor needs energy capacity upgrades to fit the requested mods. In total, these upgrades cost:" @@ -860,12 +860,12 @@ "PullFromPostmaster": "Collect Postmaster", "PullFromPostmasterError": "Unable to pull from Postmaster: {{error}}.", "PullFromPostmasterGeneralError": "Unable to pull all items from Postmaster.", - "PullFromPostmasterNotification": "Pulling 1 Postmaster item to {{store}}.", - "PullFromPostmasterNotification_female": "Pulling 1 Postmaster item to {{store}}.", - "PullFromPostmasterNotification_female_plural": "Pulling {{count}} Postmaster items to {{store}}.", - "PullFromPostmasterNotification_male": "Pulling 1 Postmaster item to {{store}}.", - "PullFromPostmasterNotification_male_plural": "Pulling {{count}} Postmaster items to {{store}}.", - "PullFromPostmasterNotification_plural": "Pulling {{count}} Postmaster items to {{store}}.", + "PullFromPostmasterNotification_female_one": "Pulling 1 Postmaster item to {{store}}.", + "PullFromPostmasterNotification_female_other": "Pulling {{count}} Postmaster items to {{store}}.", + "PullFromPostmasterNotification_male_one": "Pulling 1 Postmaster item to {{store}}.", + "PullFromPostmasterNotification_male_other": "Pulling {{count}} Postmaster items to {{store}}.", + "PullFromPostmasterNotification_one": "Pulling 1 Postmaster item to {{store}}.", + "PullFromPostmasterNotification_other": "Pulling {{count}} Postmaster items to {{store}}.", "PullFromPostmasterPopupTitle": "Pull from Postmaster", "Random": "Random", "Randomize": "Randomize Loadout", @@ -895,10 +895,10 @@ "LoadoutOptimizer": "Loadout Optimizer settings", "NativeShare": "Share Link", "Notes": "Notes", - "NumItems": "{{count}} item - recipients will be prompted to select a comparable item from their inventory", - "NumItems_plural": "{{count}} items - recipients will be prompted to select comparable items from their inventory", - "NumMods": "{{count}} mod", - "NumMods_plural": "{{count}} mods", + "NumItems_one": "{{count}} item - recipients will be prompted to select a comparable item from their inventory", + "NumItems_other": "{{count}} items - recipients will be prompted to select comparable items from their inventory", + "NumMods_one": "{{count}} mod", + "NumMods_other": "{{count}} mods", "Placeholder": "Loading share link", "Subclass": "Subclass customization", "Summary": "Share this loadout containing:", @@ -1106,8 +1106,8 @@ "PaleHeartPathfinder": "Pale Heart Pathfinder", "PercentMax": "{{pct}}% to maximum", "PercentPrestige": "{{pct}}% to reset", - "PointsUsed": "1 point used", - "PointsUsed_plural": "{{count}} points used", + "PointsUsed_one": "1 point used", + "PointsUsed_other": "{{count}} points used", "PowerBonusHeader": "+{{powerBonus}} Power Rewards", "PowerBonusHeaderUndefined": "Other Rewards", "Progress": "Progress", @@ -1117,8 +1117,8 @@ "Quests": "Quests", "Rank": "{{name}} {{rank}}", "RecordValue": "{{value}}pts", - "Resets": "1 reset", - "Resets_plural": "{{count}} resets", + "Resets_one": "1 reset", + "Resets_other": "{{count}} resets", "SecretTriumph": "Secret Triumph", "StatTrackers": "Stat Trackers", "TrackedTriumphs": "Tracked Triumphs", @@ -1216,8 +1216,8 @@ "SortByWeaponElement": "Damage Type", "SortCustom": "Custom Sort", "SortName": "Name", - "SpacesSize": "{{count}} space", - "SpacesSize_plural": "{{count}} spaces", + "SpacesSize_one": "{{count}} space", + "SpacesSize_other": "{{count}} spaces", "Theme": "Theme", "VaultArmorGroupingStyle": "Separate armor on different lines by class", "VaultGroupingNone": "None", @@ -1342,8 +1342,8 @@ "UpdateInvalid": "Failed to save data to DIM Sync", "UpdateInvalidBody": "Data sent to DIM Sync was invalid and will not be saved.", "UpdateInvalidBodyLoadout": "The loadout \"{{name}}\" is invalid and will not be saved. If you imported it from another site, please let them know that they are exporting invalid loadouts.", - "UpdateQueueLength": "{{count}} new change will be saved when we can reconnect.", - "UpdateQueueLength_plural": "{{count}} new changes will be saved when we can reconnect.", + "UpdateQueueLength_one": "{{count}} new change will be saved when we can reconnect.", + "UpdateQueueLength_other": "{{count}} new changes will be saved when we can reconnect.", "Usage": "DIM is using {{usage, humanBytes}} out of {{quota, humanBytes}} available to it on this device. This includes the downloaded Destiny item databases from Bungie.net." }, "StreamDeck": { @@ -1479,8 +1479,8 @@ } }, "WishListRoll": { - "BestRatedTip": "This perk exactly matches a weapon roll on your wishlist.", - "BestRatedTip_plural": "These perks exactly match a weapon roll on your wishlist.", + "BestRatedTip_one": "This perk exactly matches a weapon roll on your wishlist.", + "BestRatedTip_other": "These perks exactly match a weapon roll on your wishlist.", "Clear": "Clear Wish List", "CopiedLine": "Wish List roll copied to clipboard", "CopyLine": "Copy Selected Perks as Wish List Roll", @@ -1502,8 +1502,8 @@ "UpdateExternalSource": "Add Wish List", "Voltron": "voltron (default)", "WishListNotes": "Wish List Notes:", - "WorstRatedTip": "This perk exactly matches a weapon roll on your trashlist.", - "WorstRatedTip_plural": "These perks exactly match a weapon roll on your trashlist." + "WorstRatedTip_one": "This perk exactly matches a weapon roll on your trashlist.", + "WorstRatedTip_other": "These perks exactly match a weapon roll on your trashlist." }, "no-space": "no-space", "wrong-level": "wrong-level" diff --git a/src/testing/test-utils.ts b/src/testing/test-utils.ts index db8638b848..cdd78e09ff 100644 --- a/src/testing/test-utils.ts +++ b/src/testing/test-utils.ts @@ -149,8 +149,7 @@ export function setupi18n() { i18next.init({ lng: 'en', debug: true, - initImmediate: true, - compatibilityJSON: 'v3', + initAsync: true, lowerCaseLng: true, interpolation: { escapeValue: false, From a712697e1fd1d8d5f530592f2ae39544094fd97c Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Mon, 13 Jan 2025 22:02:45 -0800 Subject: [PATCH 2/2] Few tweaks --- src/app/i18n.ts | 36 +++++++++++++----------------------- src/testing/test-utils.ts | 12 ------------ 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/app/i18n.ts b/src/app/i18n.ts index 117101e52c..660ff3b37c 100644 --- a/src/app/i18n.ts +++ b/src/app/i18n.ts @@ -22,19 +22,19 @@ import { invert } from './utils/collections'; import { infoLog } from './utils/log'; export const DIM_LANG_INFOS = { - de: { pluralOverride: false, latinBased: true }, - en: { pluralOverride: false, latinBased: true }, - es: { pluralOverride: false, latinBased: true }, - 'es-mx': { pluralOverride: false, latinBased: true }, - fr: { pluralOverride: false, latinBased: true }, - it: { pluralOverride: false, latinBased: true }, - ja: { pluralOverride: true, latinBased: false }, - ko: { pluralOverride: true, latinBased: false }, - pl: { pluralOverride: true, latinBased: true }, - 'pt-br': { pluralOverride: false, latinBased: true }, - ru: { pluralOverride: true, latinBased: false }, - 'zh-chs': { pluralOverride: true, latinBased: false }, - 'zh-cht': { pluralOverride: true, latinBased: false }, + de: { latinBased: true }, + en: { latinBased: true }, + es: { latinBased: true }, + 'es-mx': { latinBased: true }, + fr: { latinBased: true }, + it: { latinBased: true }, + ja: { latinBased: false }, + ko: { latinBased: false }, + pl: { latinBased: true }, + 'pt-br': { latinBased: true }, + ru: { latinBased: false }, + 'zh-chs': { latinBased: false }, + 'zh-cht': { latinBased: false }, }; export type DimLanguage = keyof typeof DIM_LANG_INFOS; @@ -144,16 +144,6 @@ export function initi18n(): Promise { } }, ); - for (const otherLang of DIM_LANGS) { - if (DIM_LANG_INFOS[otherLang]?.pluralOverride) { - // eslint-disable-next-line - i18next.services.pluralResolver.addRule( - otherLang, - // eslint-disable-next-line - i18next.services.pluralResolver.getRule('en'), - ); - } - } }); } diff --git a/src/testing/test-utils.ts b/src/testing/test-utils.ts index cdd78e09ff..8d0b58f285 100644 --- a/src/testing/test-utils.ts +++ b/src/testing/test-utils.ts @@ -1,6 +1,5 @@ import { getBuckets } from 'app/destiny2/d2-buckets'; import { allTables, buildDefinitionsFromManifest } from 'app/destiny2/d2-definitions'; -import { DIM_LANG_INFOS } from 'app/i18n'; import { buildStores } from 'app/inventory/store/d2-store-factory'; import { downloadManifestComponents } from 'app/manifest/manifest-service-json'; import { humanBytes } from 'app/storage/human-bytes'; @@ -175,15 +174,4 @@ export function setupi18n() { }, }, }); - - for (const [otherLang, { pluralOverride }] of Object.entries(DIM_LANG_INFOS)) { - if (pluralOverride) { - // eslint-disable-next-line - i18next.services.pluralResolver.addRule( - otherLang, - // eslint-disable-next-line - i18next.services.pluralResolver.getRule('en'), - ); - } - } }