Skip to content

Instantly share code, notes, and snippets.

@aaronshaf
Last active November 26, 2016 01:39
Show Gist options
  • Save aaronshaf/2bb668095085365ecde336e37c5b2e7a to your computer and use it in GitHub Desktop.
Save aaronshaf/2bb668095085365ecde336e37c5b2e7a to your computer and use it in GitHub Desktop.
Custom Element pattern with i18n
<my-element>
<!--
provided content kept active (not inert)
.screenreader-only added in Custom Element lifecycle
-->
<select class="screenreader-only">
<option></option>
</select>
<template class="intl-messages">
<intl-message msg-id="hello" lang="en-US">Hello, { name }!</intl-message>
<intl-message msg-id="hello" lang="es">Hola, { name }!</intl-message>
</template>
<!-- generated in Custom Element lifecycle; has attached shadow root; possibly hidden from SR -->
<div aria-hidden="true"></div>
</my-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment