Spaces:
Runtime error
Runtime error
| /** | |
| * @fileoverview | |
| * Utility function to look up whether a translated video exists for a locale. | |
| */ | |
| // TODO: ja-Hira are copies of ja, replace with real ja-Hira when available. | |
| const videos = { | |
| // tw: we don't use the videos, remove them | |
| }; | |
| /** | |
| * Return a video identifier (on our video hosting service) | |
| * @param {string} videoId key in the videos object, or id string. | |
| * @param {string} locale locale to look up. If locale is not defined return the id for 'en' by default | |
| * @return {string} identifier for the video on our video hosting service. | |
| */ | |
| const translateVideo = (videoId, locale) => { | |
| // if the videoId is not recognized in the videos object, assume it's already a video id on wistia | |
| if (!videos.hasOwnProperty(videoId)) return videoId; | |
| if (videos[videoId].hasOwnProperty(locale)) { | |
| return videos[videoId][locale]; | |
| } | |
| return videos[videoId].en; | |
| }; | |
| export { | |
| translateVideo | |
| }; | |