标签: translate

MIPS 到 C 的翻译

我需要将一些 MIPS 汇编指令转换为 C 代码。我想我明白了,但这似乎违反直觉。有什么帮助吗?我们将变量 f、g、h、i、j 分别存储在寄存器 $s0、$s1、$s2、$s3 和 $s4 中。数组 A 和 B 的基数分别存储在 $s6 和 $s7 中。4 字节字。代码中的注释是我自己的。

addi $t0, $s6, 4   # $t0 = A[1]
add $t1, $s6, $0   # $t1 = A[0]
sw $t1, 0($t0)     # $t0 = A[0]
lw $t0, 0($t0)     # $t0 = A[0]
add $s0, $t1, $t0  # f = A[0] + A[0]
Run Code Online (Sandbox Code Playgroud)

我只是觉得我错了。如果我们从不使用 $t0 A[1] 为什么要先使用它呢?

c assembly reverse-engineering mips translate

5
推荐指数
1
解决办法
2万
查看次数

如何使用 Doctrine 和 Gedmo Translatable Extension 获取不同翻译的对象

我遇到了以下问题:我想获取特定语言环境的学说实体,而不破坏我的 Symfony 应用程序的默认行为。

这是我的实体之一的示例:

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @ORM\Entity(repositoryClass="ProductRepository")
 * @ORM\Table(name="product")
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="discr", type="string")
 */
class Product
{
    /**
     * @var integer $id
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     * @ORM\Column(name="name", type="string")
     * @Gedmo\Translatable
     */
    protected $name;

    // ...
}
Run Code Online (Sandbox Code Playgroud)

相关学说库的一部分:

class ProductRepository extends \Doctrine\ORM\EntityRepository
{
    public function findOneProductInLocale($id, $locale)
    {
        $qb = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.id = :id')
            ->setMaxResults(1)
            ->setParameter('id', $id);
        ;

        $query = …
Run Code Online (Sandbox Code Playgroud)

php doctrine translate symfony doctrine-orm

5
推荐指数
1
解决办法
5541
查看次数

来自 Python 中的 Microsoft Translate API 的响应

我最近一直在尝试创建一个软件,可以录制一些语音,将语音更改为文本,并将该文本翻译为另一种语言。到目前为止,我已经完成了前两个目标,但我一直在翻译方面遇到困难。

我一直在尝试使用Microsoft Translator API,并遵循设置环境时的所有说明。我设置了一个 Microsoft Azure Marketplace 帐户,设置了一个项目,启用了 API,并且我已经能够使用简单的 bash 命令来获取我的访问令牌:

curl --data "" 'https://api.cognitive.microsoft.com/sts/v1.0/issueToken?Subscription-Key=mySubscriptionKey'
Run Code Online (Sandbox Code Playgroud)

我使用 requests 和 argparse 库编写了一个小的 python 脚本来发送请求:

request = {
    'appid': ('Bearer ' + token),
    'text' : txt,
    'from' : 'en',
    'to' : 'fr'
}

response = requests.get('https://api.microsofttranslator.com/v2/http.svc', params = request)
Run Code Online (Sandbox Code Playgroud)

一切似乎都很顺利,我得到了 200 个响应(我收集的这意味着成功),但是当我尝试查看响应中的文本时,打印出了数百行晦涩的 html。在浏览了几百行之后(其中大部分列出了我选择不将文本翻译成的数十种语言),我找不到任何实际翻译的文本。Microsoft 在其 github上提供的所有示例均使用过时的 DataMarket 网站,Microsoft 正在停止将该网站作为授权链接。此外,我找不到任何实际使用的 API 示例 - 它们都只是授权示例。将令牌与“Try it Out”示例一起使用可以给我正确的结果(尽管作为 xml 文件?),所以这绝对是一个 python 问题。

那么,是否有人以前使用过这项服务并介意了解如何解释或解开此响应?

谢谢你!

python xml api translate azure

5
推荐指数
1
解决办法
1564
查看次数

Stripe Connect - 与区域设置的链接

我正在使用 API stripe Connect OAuth 参考 ( https://stripe.com/docs/connect/standard-accounts )

重定向用户的链接是: https ://connect.stripe.com/oauth/authorize?response_type=code&client_id=CODE&scope=read_write

它工作完美。登陆页面是: 在此输入图像描述

我该如何翻译此页面?我尝试过在 url: 中使用,?locale=fr但不起作用。我在文档中找不到任何内容谢谢

api hyperlink translate stripe-payments

5
推荐指数
1
解决办法
792
查看次数

SVG 多重变换 - 旋转然后水平平移

使用 SVG,我尝试将其旋转 30 度,然后水平平移 100 度。问题是,当我旋转坐标系时,它会旋转,因此当我尝试平移时,我将沿着旋转的 x 平移对象- 轴现在与水平面成 30 度。

有什么办法可以让旋转后水平平移吗?

<g transform="rotate(30 50 50) translate(100 0)">
   <rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
Run Code Online (Sandbox Code Playgroud)

我想创建用于旋转和平移上、下、左、右的控制按钮。这些将创建一个字符串,该字符串将使用数据绑定到 svg 的转换属性,从而按顺序转换对象。但平移需要相对于视口,而不是对象的旋转方式。

我使用 vue.js 框架进行数据绑定。

我也不想使用css。

谢谢,

svg transform rotation translate

5
推荐指数
1
解决办法
2540
查看次数

如何使用react-i18next通过.map()转换对象数组中的数据

刚刚开始使用 i18next,在翻译以下数据时遇到一些问题。

export const educationData = [
  { education: "Some education 1", timeframe: "2017 - 2018", id: 1 },
  { education: "Some education 2", timeframe: "2016 - 2017", id: 2 },
  { education: "Some education 3", timeframe: "2015 - 2016", id: 3 },
  { education: "Some education 4", timeframe: "2014 - 2015", id: 4 }
];
Run Code Online (Sandbox Code Playgroud)

不同语言的区域设置中的 JSON 如下所示:

"education": {
  "heading": "Education",
  "educationData": [
    {
      "id": 1,
      "education": "Some education 1",
      "timeframe": "2017 - 2018"
    },
    {
      "id": 2, …
Run Code Online (Sandbox Code Playgroud)

json dictionary translate i18next

5
推荐指数
1
解决办法
6705
查看次数

Xamarin Forms - 在运行时翻译抽屉菜单项

我正在关注Xamarin.Forms 中的多语言优秀教程(链接)

一切正常,但我有一个问题。

在我的应用程序中,我使用 Syncfusion 的导航抽屉,因为我在 ListView 中生成菜单项,如下所示。

DrawerPage.xaml

<ListView x:Name="listView"
                  SelectionMode="Single"
                  RowHeight="70"
                  ItemSelected="listView_ItemSelected"
                  SeparatorColor="Transparent">

                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Margin="32,10,0,0" 
                                         VerticalOptions="Center" >

                                <Grid RowDefinitions="1*, Auto">

                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>

                                    <Label Grid.Row="0"
                                           Grid.Column="0" 
                                           HorizontalTextAlignment="Start"
                                           HorizontalOptions="Start"
                                           FontSize="25"
                                           FontFamily="Material-Outlined"
                                           Style="{StaticResource IconLabelStyle}"
                                           Text="{Binding Icon}" />

                                    <Label Grid.Row="0"
                                           Grid.Column="1"
                                           HorizontalTextAlignment="Start"
                                           HorizontalOptions="Start"
                                           Margin="10,0,0,0" 
                                           Text="{Binding Name}" 
                                           FontSize="16"/>

                                </Grid>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
Run Code Online (Sandbox Code Playgroud)

DrawerPage.cs

private static string MAP = Lang.ResourceManager.GetString("Map");
private static string MAPICON = IconFont.ResourceManager.GetString("LocationOn");
private static string SETTINGS = Lang.ResourceManager.GetString("Settings");
private static …
Run Code Online (Sandbox Code Playgroud)

c# android translate ios xamarin

5
推荐指数
0
解决办法
253
查看次数

如何在Android应用程序中提供翻译服务

如何在Android应用中调用翻译服务?我们可以有一个可以将多种语言翻译成另一种语言的应用吗

android translate

4
推荐指数
1
解决办法
1万
查看次数

NTAccount.Translate方法失败并显示错误无法转换部分或全部标识引用

PipeAccessRule par = new PipeAccessRule("Everyone", PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow);
Run Code Online (Sandbox Code Playgroud)

此代码失败并显示错误:

无法翻译部分或全部身份参考.

我想这是因为我在非英语本地启动我的应用程序时使用"Everyone".在英语系统上一切都很好.

怎么避免这个?是否有一些enum描述了一般用户组?

堆栈跟踪:

at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)    
at System.Security.Principal.NTAccount.Translate(Type targetType)    
at System.Security.AccessControl.CommonObjectSecurity.ModifyAccess(AccessControlModification modification, AccessRule rule, Boolean& modified)    
at System.Security.AccessControl.CommonObjectSecurity.AddAccessRule(AccessRule rule)    
at System.IO.Pipes.PipeSecurity.AddAccessRule(PipeAccessRule rule)    
Run Code Online (Sandbox Code Playgroud)

.net c# translate user-accounts

4
推荐指数
1
解决办法
6296
查看次数

如果我想将一些字符更改为空,那会翻译的功能会怎么做?

我有一个sql语句:

select translate('abcdefg', 'abc', '') from dual;
Run Code Online (Sandbox Code Playgroud)

为什么结果什么都没有?我认为它应该是'defg'.

oracle translate

4
推荐指数
1
解决办法
540
查看次数