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

Try/localize url no calypso #47358

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ function enqueue_script_and_style() {

wp_set_script_translations( 'a8c-fse-editor-site-launch-script', 'full-site-editing' );

wp_localize_script(
'a8c-fse-editor-site-launch-script',
'wpcomEditorSiteLaunch',
array(
'locale' => get_locale(),
)
);

wp_enqueue_style(
'a8c-fse-editor-site-launch-style',
plugins_url( 'dist/editor-site-launch.css', __FILE__ ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { registerPlugin as originalRegisterPlugin, PluginSettings } from '@wordpress/plugins';
import { doAction, hasAction } from '@wordpress/hooks';
import { LaunchContext } from '@automattic/launch';
import { GlobalI18nProvider } from '@automattic/react-i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -41,9 +42,11 @@ registerPlugin( 'a8c-editor-site-launch', {
}

return (
<LaunchContext.Provider value={ { siteId: window._currentSiteId } }>
<LaunchModal onClose={ closeSidebar } />
</LaunchContext.Provider>
<GlobalI18nProvider localeSlug={ window.wpcomEditorSiteLaunch?.locale ?? 'en' }>
<LaunchContext.Provider value={ { siteId: window._currentSiteId } }>
<LaunchModal onClose={ closeSidebar } />
</LaunchContext.Provider>
</GlobalI18nProvider>
);
},
} );
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export const FLOW_ID = 'gutenboarding';

declare global {
interface Window {
wpcomEditorSiteLaunch?: {
locale?: string;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import * as React from 'react';
import { useSelect, useDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { useI18n } from '@automattic/react-i18n';

/**
* Internal dependencies
Expand All @@ -19,6 +19,8 @@ interface Props {
}

const LaunchMenu: React.FunctionComponent< Props > = ( { onMenuItemClick } ) => {
const { __ } = useI18n();

const { step: currentStep } = useSelect( ( select ) => select( LAUNCH_STORE ).getState() );
const LaunchStep = useSelect( ( select ) => select( LAUNCH_STORE ).getLaunchStep() );
const LaunchSequence = useSelect( ( select ) => select( LAUNCH_STORE ).getLaunchSequence() );
Expand All @@ -34,7 +36,7 @@ const LaunchMenu: React.FunctionComponent< Props > = ( { onMenuItemClick } ) =>

const { setStep } = useDispatch( LAUNCH_STORE );

const handleClick = ( step ) => {
const handleClick = ( step: LaunchStepType ) => {
setStep( step );
onMenuItemClick( step );
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import * as React from 'react';
import classnames from 'classnames';
import { ThemeProvider } from 'emotion-theming';
import { createInterpolateElement } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { useI18n } from '@automattic/react-i18n';
import { useI18nUtils } from '@automattic/i18n-utils';
import { useDispatch, useSelect } from '@wordpress/data';
import { Button, Tip } from '@wordpress/components';
import { Icon, check } from '@wordpress/icons';
Expand Down Expand Up @@ -47,6 +48,9 @@ const FinalStep: React.FunctionComponent< LaunchStepProps > = ( { onNextStep, on

const { setStep } = useDispatch( LAUNCH_STORE );

const { __ } = useI18n();
const { localizeUrl } = useI18nUtils();

const nameSummary = (
<div className="nux-launch__summary-item">
<p>
Expand Down Expand Up @@ -161,7 +165,11 @@ const FinalStep: React.FunctionComponent< LaunchStepProps > = ( { onNextStep, on
</ul>
<p>
{ __( 'Questions?', 'full-site-editing' ) }{ ' ' }
<Button isLink href="https://wordpress.com/help/contact" target="_blank">
<Button
isLink
href={ localizeUrl( 'https://wordpress.com/help/contact' ) }
target="_blank"
>
{ __( 'Ask a Happiness Engineer', 'full-site-editing' ) }
</Button>
</p>
Expand Down
1 change: 1 addition & 0 deletions apps/editing-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"@automattic/launch": "^1.0.0",
"@automattic/plans-grid": "^1.0.0-alpha.0",
"@automattic/react-i18n": "^1.0.0-alpha.0",
"@automattic/i18n-utils": "^1.0.0",
"@automattic/typography": "^1.0.0",
"@babel/core": "^7.11.1",
"@testing-library/jest-dom": "^5.9.0",
Expand Down
Loading