Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [Story localization] Use inlined JSONs for localization bundles #37836

Merged
merged 25 commits into from Mar 10, 2022

Conversation

mszylkowski
Copy link
Contributor

@mszylkowski mszylkowski commented Mar 8, 2022

If the localization strings are inlined in the document and have the correct version, then we will want to use them.

This PR allows stories on 60+ languages to be translated correctly from the AMP cache once the translations are inlined.

@amp-owners-bot
Copy link

amp-owners-bot bot commented Mar 8, 2022

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story/1.0/amp-story.js
extensions/amp-story/1.0/test/test-amp-story.js

@mszylkowski mszylkowski self-assigned this Mar 8, 2022
@mszylkowski mszylkowski added this to In progress in wg-stories Sprint via automation Mar 8, 2022
@@ -344,6 +346,21 @@ export class AmpStory extends AMP.BaseElement {
createPseudoLocale(LocalizedStringsEn, (s) => `[${s} one two]`)
);

// If there are inline strings, register as current document language.
const inlineStrings = this.win.document.querySelector(
'script[amp-strings="amp-story"]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still time to use a more specific word than just string? Would be cool to add localization or i18n or anything in the mix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change it since the transformer wasn't merged AFAIK. Sth like what's below looks good to you?

<script amp-localization="amp-story" i-amphtml-version="123456"></script>

to follow closely

<style amp-extension="amp-story" i-amphtml-version="123456"></style>

cc @erwinmombay for the transformer change.

extensions/amp-story/1.0/amp-story.js Outdated Show resolved Hide resolved
extensions/amp-story/1.0/amp-story.js Outdated Show resolved Hide resolved
extensions/amp-story/1.0/amp-story.js Outdated Show resolved Hide resolved
extensions/amp-story/1.0/amp-story.js Outdated Show resolved Hide resolved
extensions/amp-story/1.0/amp-story.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants