Skip to content

Commit

Permalink
test(app): enforce branded localization rules (#16251)
Browse files Browse the repository at this point in the history
codifies rules for branded copy: 
1) branded.json and anonymous.json should have the same translation keys
2) copy in other localization assets should not contain "Opentrons" or
"Flex"

closes PLAT-267
  • Loading branch information
brenthagen authored Sep 17, 2024
1 parent 0159c5e commit 17ac415
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/src/LocalizationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export interface OnDeviceLocalizationProviderProps {
children?: React.ReactNode
}

const BRANDED_RESOURCE = 'branded'
const ANONYMOUS_RESOURCE = 'anonymous'
export const BRANDED_RESOURCE = 'branded'
export const ANONYMOUS_RESOURCE = 'anonymous'

// TODO(bh, 2024-03-26): anonymization limited to ODD for now, may change in future OEM phases
export function OnDeviceLocalizationProvider(
Expand Down
34 changes: 34 additions & 0 deletions app/src/assets/localization/__tests__/branded.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { describe, it, expect } from 'vitest'
import {
ANONYMOUS_RESOURCE,
BRANDED_RESOURCE,
} from '../../../LocalizationProvider'
import { resources } from '..'

describe('branded copy', () => {
it('branded and anonymous resources contain the same translation keys', () => {
const brandedKeys = Object.keys(resources.en[BRANDED_RESOURCE])
const anonymousKeys = Object.keys(resources.en[ANONYMOUS_RESOURCE])

brandedKeys.forEach((brandedKey, i) => {
const anonymousKey = anonymousKeys[i]
expect(brandedKey).toEqual(anonymousKey)
})
})

it('non-branded copy does not contain "Opentrons" or "Flex"', () => {
const nonBrandedResources = Object.entries(resources.en).filter(
resource =>
resource[0] !== BRANDED_RESOURCE && resource[0] !== ANONYMOUS_RESOURCE
)

const nonBrandedCopy = nonBrandedResources
.map(resource => Object.values(resource[1]))
.flat()

nonBrandedCopy.forEach(phrase => {
expect(phrase.match(/opentrons/i)).toBeNull()
expect(phrase.match(/flex/i)).toBeNull()
})
})
})
14 changes: 8 additions & 6 deletions app/src/assets/localization/en/anonymous.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"a_robot_software_update_is_available": "A robot software update is required to run protocols with this version of the desktop app. <robotLink>Go to Robot</robotLink>",
"about_flex_gripper": "About Gripper",
"alternative_security_types_description": "The robot supports connecting to various enterprise access points. Connect via USB and finish setup in the desktop app.",
"attach_a_pipette": "Attach a pipette to your robot",
"attach_a_pipette_for_quick_transfer": "To create a quick transfer, you need to attach a pipette to your robot.",
"attach_a_pipette": "Attach a pipette to your robot",
"calibration_block_description": "<block>This block is a specially made tool that fits perfectly on your deck and helps with calibration.</block><block>If you do not have a Calibration Block, please email support so we can send you one. In your message, be sure to include your name, company or institution name, and shipping address. While you wait for the block to arrive, you can use the flat surface on the trash bin of your robot instead.</block>",
"calibration_on_opentrons_tips_is_important": "It’s extremely important to perform this calibration using the tips and tip racks specified above, as the robot determines accuracy based on the known measurements of these tips.",
"choose_what_data_to_share": "Choose what robot data to share.",
Expand Down Expand Up @@ -37,17 +37,19 @@
"module_calibration_get_started": "<block>To get started, remove labware from the deck and clean up the working area to make the calibration easier. Also gather the needed equipment shown to the right.</block><block>The calibration adapter came with your module. The pipette probe came with your pipette.</block>",
"module_error_contact_support": "Try powering the module off and on again. If the error persists, contact support.",
"network_setup_menu_description": "You’ll use this connection to run software updates and load protocols onto your robot.",
"new_robot_instructions": "When setting up a new robot, follow the instructions on the touchscreen. For more information, consult the Quickstart Guide for your robot.",
"oem_mode_description": "Enable OEM Mode to remove all instances of Opentrons from the Flex touchscreen.",
"opentrons_app_successfully_updated": "The app was successfully updated.",
"opentrons_app_update": "app update",
"opentrons_app_update_available": "App Update Available",
"opentrons_app_update_available_variation": "An app update is available.",
"opentrons_app_update_available": "App Update Available",
"opentrons_app_update": "app update",
"opentrons_app_will_use_interpreter": "If specified, the app will use the Python interpreter at this path instead of the default bundled Python interpreter.",
"opentrons_cares_about_privacy": "We care about your privacy. We anonymize all data and only use it to improve our products.",
"opentrons_def": "Verified Definition",
"opentrons_flex_quickstart_guide": "Quickstart Guide",
"opentrons_labware_def": "Verified labware definition",
"opentrons_tip_racks_recommended": "Opentrons tip racks are highly recommended. Accuracy cannot be guaranteed with other tip racks.",
"opentrons_tip_rack_name": "opentrons",
"opentrons_tip_racks_recommended": "Opentrons tip racks are highly recommended. Accuracy cannot be guaranteed with other tip racks.",
"previous_releases": "View previous releases",
"receive_alert": "Receive an alert when a software update is available.",
"restore_description": "Reverting to previous software versions is not recommended, but you can access previous releases below. For best results, uninstall the existing app and remove its configuration files before installing the previous version.",
Expand All @@ -58,11 +60,11 @@
"secure_labware_explanation_thermocycler": "Secure your labware to the Thermocycler Module by closing its latch. Doing so ensures level and accurate plate placement for optimal results.",
"send_a_protocol_to_store": "Send a protocol to the robot to get started.",
"setup_instructions_description": "For step-by-step instructions on setting up your module, consult the Quickstart Guide that came in its box.",
"share_app_analytics": "Share App Analytics",
"share_app_analytics_description": "Help improve this product by automatically sending anonymous diagnostics and usage data.",
"share_app_analytics": "Share App Analytics",
"share_display_usage_description": "Data on how you interact with the robot's touchscreen.",
"share_logs_with_opentrons": "Share robot logs",
"share_logs_with_opentrons_description": "Help improve this product by automatically sending anonymous robot logs. These logs are used to troubleshoot robot issues and spot error trends.",
"share_logs_with_opentrons": "Share robot logs",
"show_labware_offset_snippets_description": "Only for users who need to apply labware offset data outside of the app. When enabled, code snippets for Jupyter Notebook and SSH are available during protocol setup.",
"something_seems_wrong": "There may be a problem with your pipette. Exit setup and contact support for assistance.",
"storage_limit_reached_description": "Your robot has reached the limit of quick transfers that it can store. You must delete an existing quick transfer before creating a new one.",
Expand Down
14 changes: 8 additions & 6 deletions app/src/assets/localization/en/branded.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"a_robot_software_update_is_available": "A robot software update is required to run protocols with this version of the Opentrons App. <robotLink>Go to Robot</robotLink>",
"attach_a_pipette": "Attach a pipette to your Flex",
"attach_a_pipette_for_quick_transfer": "To create a quick transfer, you need to attach a pipette to your Opentrons Flex.",
"about_flex_gripper": "About Flex Gripper",
"alternative_security_types_description": "The Opentrons App supports connecting Flex to various enterprise access points. Connect via USB and finish setup in the app.",
"attach_a_pipette_for_quick_transfer": "To create a quick transfer, you need to attach a pipette to your Opentrons Flex.",
"attach_a_pipette": "Attach a pipette to your Flex",
"calibration_block_description": "<block>This block is a specially made tool that fits perfectly on your deck and helps with calibration.</block><block>If you do not have a Calibration Block, please email <supportLink>[email protected]</supportLink> so we can send you one. In your message, be sure to include your name, company or institution name, and shipping address. While you wait for the block to arrive, you can use the flat surface on the trash bin of your robot instead.</block>",
"calibration_on_opentrons_tips_is_important": "It’s extremely important to perform this calibration using the Opentrons tips and tip racks specified above, as the robot determines accuracy based on the known measurements of these tips.",
"choose_what_data_to_share": "Choose what data to share with Opentrons.",
Expand Down Expand Up @@ -37,14 +37,16 @@
"module_calibration_get_started": "<block>To get started, remove labware from the deck and clean up the working area to make the calibration easier. Also gather the needed equipment shown to the right.</block><block>The calibration adapter came with your module. The pipette probe came with your Flex pipette.</block>",
"module_error_contact_support": "Try powering the module off and on again. If the error persists, contact Opentrons Support.",
"network_setup_menu_description": "You’ll use this connection to run software updates and load protocols onto your Opentrons Flex.",
"new_robot_instructions": "When setting up a new Flex, follow the instructions on the touchscreen. For more information, consult the Quickstart Guide for your robot.",
"oem_mode_description": "Enable OEM Mode to remove all instances of Opentrons from the Flex touchscreen.",
"opentrons_app_successfully_updated": "The Opentrons App was successfully updated.",
"opentrons_app_update": "Opentrons App update",
"opentrons_app_update_available": "Opentrons App Update Available",
"opentrons_app_update_available_variation": "An Opentrons App update is available.",
"opentrons_app_update_available": "Opentrons App Update Available",
"opentrons_app_update": "Opentrons App update",
"opentrons_app_will_use_interpreter": "If specified, the Opentrons App will use the Python interpreter at this path instead of the default bundled Python interpreter.",
"opentrons_cares_about_privacy": "Opentrons cares about your privacy. We anonymize all data and only use it to improve our products.",
"opentrons_def": "Opentrons Definition",
"opentrons_flex_quickstart_guide": "Opentrons Flex Quickstart Guide",
"opentrons_labware_def": "Opentrons labware definition",
"opentrons_tip_rack_name": "opentrons",
"opentrons_tip_racks_recommended": "Opentrons tip racks are highly recommended. Accuracy cannot be guaranteed with other tip racks.",
Expand All @@ -58,11 +60,11 @@
"secure_labware_explanation_thermocycler": "Opentrons recommends securing your labware to the Thermocycler Module by closing its latch. Doing so ensures level and accurate plate placement for optimal results.",
"send_a_protocol_to_store": "Send a protocol from the Opentrons App to get started.",
"setup_instructions_description": "For step-by-step instructions on setting up your module, consult the Quickstart Guide that came in its box or scan the QR code to visit the modules section of the Opentrons Help Center.",
"share_app_analytics": "Share App Analytics with Opentrons",
"share_app_analytics_description": "Help Opentrons improve its products and services by automatically sending anonymous diagnostics and usage data.",
"share_app_analytics": "Share App Analytics with Opentrons",
"share_display_usage_description": "Data on how you interact with the touchscreen on Flex.",
"share_logs_with_opentrons": "Share Robot logs with Opentrons",
"share_logs_with_opentrons_description": "Help Opentrons improve its products and services by automatically sending anonymous robot logs. Opentrons uses these logs to troubleshoot robot issues and spot error trends.",
"share_logs_with_opentrons": "Share Robot logs with Opentrons",
"show_labware_offset_snippets_description": "Only for users who need to apply labware offset data outside of the Opentrons App. When enabled, code snippets for Jupyter Notebook and SSH are available during protocol setup.",
"something_seems_wrong": "There may be a problem with your pipette. Exit setup and contact Opentrons Support for assistance.",
"storage_limit_reached_description": "Your Opentrons Flex has reached the limit of quick transfers that it can store. You must delete an existing quick transfer before creating a new one.",
Expand Down
2 changes: 0 additions & 2 deletions app/src/assets/localization/en/devices_landing.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
"looking_for_robots": "Looking for robots",
"make_sure_robot_is_connected": "Make sure the robot is connected to this computer",
"modules": "Modules",
"new_robot_instructions": "When setting up a new Flex, follow the instructions on the touchscreen. For more information, consult the Quickstart Guide for your robot.",
"ninety_six_mount": "Left + Right Mount",
"no_robots_found": "No robots found",
"not_available": "Not available ({{count}})",
"opentrons_flex_quickstart_guide": "Opentrons Flex Quickstart Guide",
"ot2_quickstart_guide": "OT-2 Quickstart Guide",
"refresh": "Refresh",
"restart_the_app": "Restart the app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const NEW_OT2_SETUP_SUPPORT_ARTICLE_HREF =
'https://insights.opentrons.com/hubfs/Products/OT-2/OT-2%20Quick%20Start%20Guide.pdf'

export function NewRobotSetupHelp(): JSX.Element {
const { t } = useTranslation(['devices_landing', 'shared'])
const { t } = useTranslation(['devices_landing', 'shared', 'branded'])
const [showNewRobotHelpModal, setShowNewRobotHelpModal] = React.useState(
false
)
Expand All @@ -49,13 +49,13 @@ export function NewRobotSetupHelp(): JSX.Element {
>
<Flex flexDirection={DIRECTION_COLUMN}>
<LegacyStyledText as="p" marginBottom={SPACING.spacing16}>
{t('new_robot_instructions')}
{t('branded:new_robot_instructions')}
</LegacyStyledText>
<ExternalLink
href={NEW_FLEX_SETUP_SUPPORT_ARTICLE_HREF}
width={FLEX_MAX_CONTENT}
>
{t('opentrons_flex_quickstart_guide')}
{t('branded:opentrons_flex_quickstart_guide')}
</ExternalLink>
<ExternalLink
href={NEW_OT2_SETUP_SUPPORT_ARTICLE_HREF}
Expand Down

0 comments on commit 17ac415

Please sign in to comment.