Skip to content

Instantly share code, notes, and snippets.

@ryzokuken
Created June 20, 2024 13:18
Show Gist options
  • Save ryzokuken/4a133af02235f74dd7dbc048def25883 to your computer and use it in GitHub Desktop.
Save ryzokuken/4a133af02235f74dd7dbc048def25883 to your computer and use it in GitHub Desktop.
import { MessageFormat } from 'npm:messageformat@next'
const decoder = new TextDecoder("utf-8");
const msg = decoder.decode(Deno.readFileSync(Deno.args[0]));
const mf = new MessageFormat(msg, Deno.args[1].split(','));
console.log(mf.format(JSON.parse(Deno.args[2] ?? '')));
.match {$total :number}
one {{ Showing {$start} - {$end} of {$total} result }}
* {{ Showing {$start} - {$end} of {$total} results }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment