Skip to content

Commit

Permalink
fix gettext.js bug and translate tool requirement strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Aug 10, 2022
1 parent 9bf36f9 commit 109cf80
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ajv": "^8",
"babel-jest": "^28.1.1",
"fuzzysort": "^2.0.1",
"gettext.js": "^1.2.0",
"gettext.js": "nornagon/gettext.js#bdf27db",
"gh-pages": "^3.1.0",
"husky": "^7.0.4",
"jest": "^28.1.1",
Expand Down
35 changes: 29 additions & 6 deletions src/types/item/RequirementDataTools.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,37 @@ let { tools, qualities } =
{#each tools as toolChoices}
<li>
{#each toolChoices as tool, i}
{#if i !== 0}{" OR "}{/if}
{#if data.craftingPseudoItem(tool.id)}
<a href="#/furniture/{data.craftingPseudoItem(tool.id)}"
>{singularName(data.byId("item", tool.id))}</a>
{#if i !== 0}{i18n.__(" OR ")}{/if}
{#if tool.count <= 0}
{#if data.craftingPseudoItem(tool.id)}
<a href="#/furniture/{data.craftingPseudoItem(tool.id)}"
>{singularName(data.byId("item", tool.id))}</a>
{:else}
<ThingLink type="item" id={tool.id} />
{/if}
{:else}
<ThingLink type="item" id={tool.id} />
<InterpolatedTranslation
str={i18n
.dcnpgettext(
null,
"requirement",
"%1$s (%2$d charge)",
"%1$s (%2$d charges)",
tool.count,
"\x000",
tool.count
)
.replace(/\$./g, "")}>
<svelte:fragment slot="0">
{#if data.craftingPseudoItem(tool.id)}
<a href="#/furniture/{data.craftingPseudoItem(tool.id)}"
>{singularName(data.byId("item", tool.id))}</a>
{:else}
<ThingLink type="item" id={tool.id} />
{/if}
</svelte:fragment>
</InterpolatedTranslation>
{/if}
{#if tool.count > 0}({tool.count} charge{#if tool.count !== 1}s{/if}){/if}
{/each}
</li>
{/each}
Expand Down
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3278,10 +3278,9 @@ [email protected]:
dependencies:
gettext-parser "^1.4.0"

gettext.js@^1.2.0:
gettext.js@nornagon/gettext.js#bdf27db:
version "1.2.0"
resolved "https://registry.yarnpkg.com/gettext.js/-/gettext.js-1.2.0.tgz#783e166c604bc60c4b70f4656391038aa9e950b2"
integrity sha512-qOafHtn/xsXKiBOFO8enhdx8k09ViBYSnckhn4pn/QLCpQMF8S87q9f4cE2pVgbqWD9/9SyGpWRO0nWJsEDmlg==
resolved "https://codeload.github.com/nornagon/gettext.js/tar.gz/bdf27dbf5be79a05a2ee2ce9bddf72a101d9e4f3"
dependencies:
po2json "^1.0.0-beta-3"

Expand Down

0 comments on commit 109cf80

Please sign in to comment.