Update JS translation system to use function instead of directly array