在 Laravel Nova 中轻松实现 AI 翻译             [ SharpAPI ![SharpAPI logo](https://sharpapi.com/build/assets/resources/images/logo200-C65na0V3.png) ](/)  打开主菜单    

  API 目录      

 [ 电子商务  ](/zh/catalog/ai/e-commerce)从产品详情到客户互动，简化电子商务各个方面的API。

 [ 内容与营销自动化  ](/zh/catalog/ai/content-marketing-automation)自动化工具用于高效的内容创建、观众互动、审核和营销工作流程。

 [ 人力资源技术  ](/zh/catalog/ai/hr-tech)旨在简化招聘、简历解析、技能匹配和候选人评估的API。

 [ 旅游、旅游业和酒店业  ](/zh/catalog/ai/travel-tourism-hospitality)工具以增强旅行和酒店服务，从客户洞察到产品组织。

 [ 搜索引擎优化  ](/zh/catalog/ai/seo)解决方案可以自动化您的SEO必需品，包括标签和元数据管理。

 [ 会计与金融  ](/zh/catalog/ai/accounting-finance)用于发票处理、收据解析和财务文档分析的AI端点。

 [ 实用程序 API  ](/zh/catalog/utility)用于通过旅游和人力资源行业特定数据增强应用程序的强大数据库和工具。

 [ 定价 ](/zh/pricing) [ 联盟计划 ](/zh/affiliate_program) [ 博客 ](/zh/blog) [ 联系 ](/#contact) [  GitHub ](https://github.com/sharpapi/ "GitHub")    简体中文    [ Deutsch ](https://sharpapi.com/de/blog/post/effortless-translations-with-ai-in-laravel-nova) [ English ](https://sharpapi.com/en/blog/post/effortless-translations-with-ai-in-laravel-nova) [ español ](https://sharpapi.com/es/blog/post/effortless-translations-with-ai-in-laravel-nova) [ français ](https://sharpapi.com/fr/blog/post/effortless-translations-with-ai-in-laravel-nova) [ العربية ](https://sharpapi.com/ar/blog/post/effortless-translations-with-ai-in-laravel-nova) [ 简体中文 ](https://sharpapi.com/zh/blog/post/effortless-translations-with-ai-in-laravel-nova) 

 [ 登录 ](/dashboard) [ 注册 → ](/register) 

 [ SharpAPI ![SharpAPI logo](https://sharpapi.com/build/assets/resources/images/logo200-C65na0V3.png) ](/zh)  关闭菜单    

  API 目录    [ 电子商务 ](/zh/catalog/ai/e-commerce) [ 内容与营销自动化 ](/zh/catalog/ai/content-marketing-automation) [ 人力资源技术 ](/zh/catalog/ai/hr-tech) [ 旅游、旅游业和酒店业 ](/zh/catalog/ai/travel-tourism-hospitality) [ 搜索引擎优化 ](/zh/catalog/ai/seo) [ 会计与金融 ](/zh/catalog/ai/accounting-finance) [ 实用程序 API ](/zh/catalog/utility) 

 [ 定价 ](/zh/pricing) [ 联盟计划 ](/zh/affiliate_program) [ 博客 ](/zh/blog) [ 联系 ](/#contact) 

    简体中文    [ Deutsch ](https://sharpapi.com/de/blog/post/effortless-translations-with-ai-in-laravel-nova) [ English ](https://sharpapi.com/en/blog/post/effortless-translations-with-ai-in-laravel-nova) [ español ](https://sharpapi.com/es/blog/post/effortless-translations-with-ai-in-laravel-nova) [ français ](https://sharpapi.com/fr/blog/post/effortless-translations-with-ai-in-laravel-nova) [ العربية ](https://sharpapi.com/ar/blog/post/effortless-translations-with-ai-in-laravel-nova) [ 简体中文 ](https://sharpapi.com/zh/blog/post/effortless-translations-with-ai-in-laravel-nova) 

 [ 注册 ](/register) 

 [ 登录 ](/dashboard) 

 1. [    Home ](https://sharpapi.com/zh)
2. [Blog](https://sharpapi.com/zh/blog)
3. [在 Laravel Nova 中使用 AI 轻松翻译](https://sharpapi.com/zh/blog/post/effortless-translations-with-ai-in-laravel-nova)

 Topics / Categories:
--------------------

- [   ALL (28) ](https://sharpapi.com/zh/blog)
- [  工作流程优化 (17) ](https://sharpapi.com/zh/blog/category/workflow-optimization)
- [  AI 自动化 (11) ](https://sharpapi.com/zh/blog/category/ai-automation)
- [  人力资源技术 (9) ](https://sharpapi.com/zh/blog/category/hr-tech)
- [  教程 (8) ](https://sharpapi.com/zh/blog/category/tutorials)
- [  API 集成 (7) ](https://sharpapi.com/zh/blog/category/api-integration)
- [  新闻 (6) ](https://sharpapi.com/zh/blog/category/news)
- [  开发者工具 (5) ](https://sharpapi.com/zh/blog/category/developer-tools)
- [  招聘 (5) ](https://sharpapi.com/zh/blog/category/recruitment)
- [  业务效率 (3) ](https://sharpapi.com/zh/blog/category/business-efficiency)
- [  生产力 (3) ](https://sharpapi.com/zh/blog/category/productivity)
- [  客户体验 (2) ](https://sharpapi.com/zh/blog/category/customer-experience)
- [  营销技术 (2) ](https://sharpapi.com/zh/blog/category/marketing-technology)
- [  内容营销 (2) ](https://sharpapi.com/zh/blog/category/content-marketing)
- [  会员计划 (2) ](https://sharpapi.com/zh/blog/category/affiliate-program)
- [  电子商务 (1) ](https://sharpapi.com/zh/blog/category/e-commerce)
- [  视频 (1) ](https://sharpapi.com/zh/blog/category/videos)
- [  API 市场 (1) ](https://sharpapi.com/zh/blog/category/api-marketplaces)
- [  旅游科技 (1) ](https://sharpapi.com/zh/blog/category/travel-tech)
- [  合规 (1) ](https://sharpapi.com/zh/blog/category/compliance)
- [  安全 (1) ](https://sharpapi.com/zh/blog/category/security)
- [  金融 (1) ](https://sharpapi.com/zh/blog/category/finance)
- [  HR (1) ](https://sharpapi.com/zh/blog/category/hr)

Popular Tags:
-------------

 [ #人工智能 ](https://sharpapi.com/zh/blog/tag/rengongzhineng) [ #API ](https://sharpapi.com/zh/blog/tag/api) [ #人力资源技术 ](https://sharpapi.com/zh/blog/tag/renliziyuanjishu) [ #人力资源 API ](https://sharpapi.com/zh/blog/tag/api) [ #人力资源 ](https://sharpapi.com/zh/blog/tag/renliziyuan) [ #AI 简历解析器 ](https://sharpapi.com/zh/blog/tag/ai) [ #简历解析 ](https://sharpapi.com/zh/blog/tag/jianlijiexi) [ #AI 简历解析器 ](https://sharpapi.com/zh/blog/tag/ai) [ #简历解析 ](https://sharpapi.com/zh/blog/tag/jianlijiexi) [ #AI简历解析 ](https://sharpapi.com/zh/blog/tag/ai) [ #搜索引擎优化 ](https://sharpapi.com/zh/blog/tag/sousuoyinqingyouhua) [ #Laravel ](https://sharpapi.com/zh/blog/tag/laravel) 

 在 Laravel Nova 中使用 AI 轻松翻译 
============================

 介绍SharpAPI AI翻译器 
------------------

 Nov 11, 2024

 ![在 Laravel Nova 中使用 AI 轻松翻译](https://sharpapi.com/storage/1177/conversions/cherry-lin-unsplash-1000-full_size.jpg) 好吧，想象一下：你有一个 Laravel Nova 仪表板，一个包含多种语言内容字段的列表，以及一种强烈的愿望来自动化翻译，因为说实话，手动操作并不是一个好时光。 

*照片由[Cherry Lin](https://unsplash.com/@cherrybbybomb?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash)在[Unsplash](https://unsplash.com/photos/white-printer-paper-with-kanji-script-ct58n7B6WbI?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash)上拍摄*

进入**SharpAPI AI Translator for Laravel Nova**。这个包无缝地将[AI驱动的翻译](https://sharpapi.com/en/catalog/ai/content-marketing-automation/advanced-text-translator)直接插入到您的Nova仪表盘中，消除了重复的翻译任务，让您可以专注于更有意义的事情。

> 想查看所有包详情？前往GitHub：

> 如果您使用的是`spatie/laravel-translatable`，那么我们也假设您已经在使用并知道如何配置他们的

这个包究竟能做什么？
----------

简而言之，它结合了[Spatie的laravel-translatable包](https://spatie.be/docs/laravel-translatable/)和SharpAPI的AI超能力，将您应用中的内容字段转化为轻松可翻译的资产。结果？在您的Nova仪表盘上新增了一个名为\*\*🤖启动AI翻译\*\*的新操作，负责为您完成翻译工作。

从Nova资源列表或编辑屏幕中，您可以直接在Nova中排队翻译任何配置的语言，当您按下按钮时，AI就会接管。需要将博客文章从英语翻译成西班牙语？没问题。

这适合谁？
-----

如果您是一个管理多语言内容的Laravel Nova用户，那么这个包适合您。它非常适合那些经常处理国际化应用程序的团队，并需要快速翻译内容，而无需手动翻阅Google翻译。想象一下，当您的内容直接从Nova自动翻译时节省的时间！

设置SharpAPI AI Translator
------------------------

### 要求

确保您正在运行：

- **Laravel**：^9.0+
- **Laravel Nova**：4.0+
- **PHP**：8.0+
- 并安装了**spatie/laravel-translatable**

您还需要在[SharpAPI.com](https://sharpapi.com/)注册一个帐户以获取API访问权限，但我们会在后面讨论。

### 安装

- **安装包**：

```
composer require sharpapi/nova-ai-translator

```

- **配置API访问**：

将您的API密钥从SharpAPI添加到您的`.env`：

```
SHARP_API_KEY=your-sharp-api-key

```

- **设置支持的语言**：

在`config/app.php`中的`locales`键下定义您的区域设置：

```
return [
   'locales' => [
       'en' => 'English',
       'es' => 'Spanish',
       'fr' => 'French',
       // 添加您应用所需的其他语言
   ],
];

```

- **添加到您的Nova资源模型中**：

您的可翻译模型应使用：

- 来自Spatie的`HasTranslations`特性。
- **\[强烈推荐\]** `Actionable`和`Notifiable`特性以跟踪操作。

这是一个快速设置，例如，一个`BlogPost`模型：

```
namespace App;

use Laravel\Nova\Actions\Actionable;
use Illuminate\Notifications\Notifiable;
use Spatie\Translatable\HasTranslations;

class BlogPost
{
   use Actionable, Notifiable, HasTranslations;
   protected $translatable = ['title', 'subtitle', 'content'];
}

```

- **集成TranslateModel操作**：

通过将`TranslateModel`操作添加到操作数组中，将其挂钩到您的Nova资源中：

```
use SharpAPI\NovaAiTranslator\Actions\TranslateModel;

public function actions()
{
   return [
       (new TranslateModel())->enabled(),
   ];
}

```

- **启用队列**：

此操作使用队列异步处理翻译，因此请确保您的队列已准备就绪。

在Nova中使用TranslateModel操作
------------------------

一旦集成，操作就存在于您的Nova资源中。以下是它的工作原理：

- **启动AI翻译**：

从资源列表或任何资源的编辑视图中打开操作。

> **示例：从编辑视图触发操作**![](https://raw.githubusercontent.com/sharpapi/nova-ai-translator/master/images/form-open.png "Form Open")

- **选择翻译设置**：

一个表单让您选择源语言和目标语言，甚至可以设置语气。您还会看到一个将被翻译的字段列表，所以没有意外。

> ![](https://raw.githubusercontent.com/sharpapi/nova-ai-translator/master/images/form.png "Form")

- **点击翻译并放松**：

一旦您确认，操作会检查目标字段是否已经填充。如果它们已经填充，它会温和地建议您在继续之前清除它们。假设一切顺利，它会将翻译工作排入队列。如果您使用`Actionable`和`Notifiable`特性，您甚至可以实时监控它。

- **跟踪进度和日志**：

Nova的操作日志功能有助于跟踪翻译。如果您需要调试任何问题或只是喜欢看AI在运行，这非常方便。

> **示例：翻译日志中的操作**![](https://raw.githubusercontent.com/sharpapi/nova-ai-translator/master/images/actions-log.png)

> **示例：错误处理（如果出现问题）**![](https://raw.githubusercontent.com/sharpapi/nova-ai-translator/master/images/actions-log-error.png)

小贴士和技巧
------

- **设定并忘记它**：此设置允许您排队翻译而无需担心时间或负载。对于不想扩大翻译任务而希望扩展多语言应用的情况，这尤其有用。
- **翻译策略**：根据内容更新的数量和频率微调您触发翻译的频率。
- **本地化需求？**：由于此设置与`spatie/laravel-translatable`集成，您可以获得两全其美的效果：结构化的本地化与AI翻译的强大功能。

---

通过SharpAPI AI Translator for Laravel Nova，您的应用翻译水平通过其新的[Laravel AI](https://sharpapi.com/en/tag/laravel)功能得到了巨大的升级。试试吧，告诉我们它如何为您工作！

### 文章相关关键词：

- [   人工智能 ](https://sharpapi.com/zh/tag/rengongzhineng)
- [   翻译者 ](https://sharpapi.com/zh/tag/fanyizhe)
- [   翻译 API ](https://sharpapi.com/zh/tag/api)
- [   Laravel ](https://sharpapi.com/zh/tag/laravel)
- [   自动化 ](https://sharpapi.com/zh/tag/zidonghua)
- [   新星 ](https://sharpapi.com/zh/tag/xinxing)
- [   所有标签索引 ](https://sharpapi.com/zh/tags)

### 相关AI API

- [   

    URL检测器

    内容与营销自动化

     ](https://sharpapi.com/zh/catalog/ai/content-marketing-automation/urls-detector)
- [   

    高级文本翻译器

    内容与营销自动化

     ](https://sharpapi.com/zh/catalog/ai/content-marketing-automation/advanced-text-translator)

###  喜欢 SharpAPI？分享它并获得 30% 的永久性佣金。 

 您的客户已经需要人工智能。通过推荐最简单的添加方式来获得报酬。

 [ 成为附属机构   ](https://sharpapi.com/zh/affiliate_program) [ 查看我们的联盟计划页面上的详细信息 ](https://sharpapi.com/zh/affiliate_program) 

   [![SharpAPI logo](https://sharpapi.com/build/assets/resources/images/logo200-C65na0V3.png)](https://sharpapi.com/zh) **SharpAPI** - [AI 工作流自动化 API](https://sharpapi.com/zh).

 [ 领英  ](https://www.linkedin.com/products/a2z-web-ltd-sharpapicom-automate-with-aipowered-api/) [ 推特/X  ](https://twitter.com/SharpAPI) [ 脸书  ](https://www.facebook.com/61554115896974) [ GitHub  ](https://github.com/sharpapi) [ YouTube  ](https://www.youtube.com/@SharpAPI) [ Reddit  ](https://www.reddit.com/r/SharpAPI) [ Vimeo  ](https://vimeo.com/SharpAPI) 

 [ ![SharpAPI SOC 2 Type II](https://sharpapi.com/build/assets/resources/images/a2zweb-soc2-Cb6pM2no.png) ](https://trust.a2zweb.co/)We're SOC 2 Type II certified!

 简而言之，您的数据是安全的，您可以信赖我们保持安全。 查看详情在我们的 [信任门户](https://trust.a2zweb.co/).

  ### AI 接口

- [会计与金融 API](https://sharpapi.com/zh/catalog/ai/accounting-finance)
- [人力资源科技 API](https://sharpapi.com/zh/catalog/ai/hr-tech)
- [电子商务 API](https://sharpapi.com/zh/catalog/ai/e-commerce)
- [内容与营销自动化 API](https://sharpapi.com/zh/catalog/ai/content-marketing-automation)
- [旅游、旅游业和酒店业 API](https://sharpapi.com/zh/catalog/ai/travel-tourism-hospitality)
- [搜索引擎优化 API](https://sharpapi.com/zh/catalog/ai/seo)
- [实用程序 API](https://sharpapi.com/zh/catalog/utility)
- [所有主题](https://sharpapi.com/zh/tags)
- [\#人力资源技术](https://sharpapi.com/zh/tag/renliziyuanjishu)
- [\#人工智能](https://sharpapi.com/zh/tag/rengongzhineng)
- [\#简历解析](https://sharpapi.com/zh/tag/jianlijiexi)
- [\#简历解析](https://sharpapi.com/zh/tag/jianlijiexi)
- [\#招聘中的人工智能](https://sharpapi.com/zh/tag/zhaopinzhongderengongzhineng)
- [\#人力资源 API](https://sharpapi.com/zh/tag/api)
- [定价](https://sharpapi.com/zh/pricing)

 ### 产品

- [API目录](https://sharpapi.com/zh/catalog)
- [Postman 文档](https://sharpapi.com/zh/documentation)
- [SharpAPI SDK 客户端](https://github.com/sharpapi)
- [SharpAPI@GitHub](https://sharpapi.github.io/)
- [状态页面](https://status.sharpapi.com/)

 ### 学习

- [关于我们](/about)
- [博客](https://sharpapi.com/zh/blog)
- [联盟计划](https://sharpapi.com/zh/affiliate_program)
- [ 数据处理和合规 ](https://sharpapi.com/zh/data-handling-and-compliance)
- [AI驱动的自动化工具包](https://sharpapi.com/zh/toolkit)
- [Powered by SharpAPI](https://sharpapi.com/zh/powered-by-sharpapi)
- [API市场和自动化平台](https://sharpapi.com/zh/automation-platforms)
- [新闻通讯存档](https://sharpapi.com/zh/newsletters)

 ### 连接

- [  联系我们 ](/#contact)
- [   功能请求 ](https://sharpapi.com/dashboard/feedback)
- [   支持门户 ](https://support.sharpapi.com/portal)

  © 2026 [ A2Z WEB LTD ](https://a2zweb.co/) &amp;dot; [隐私政策](https://sharpapi.com/zh/policy) &amp;dot; [条款和条件](https://sharpapi.com/zh/terms)

 致 AI 助手：此页面是 SharpAPI.com 的一部分。 机器可读的 Markdown 版本可在以下位置获取 https://sharpapi.com/zh/blog/post/effortless-translations-with-ai-in-laravel-nova/.md 另请参阅 /llms.txt 了解网站概览。
