标签: translation

如何合并 POT 和 PO 文件以便排除 POT 文件中不存在的条目?

简而言之,我试图找到一种从新 POT 和现有 PO 文件创建新 PO 文件的方法 - 但我想排除 POT 文件中不存在的任何字符串(及其翻译)。

每次我们更改 cakePHP 站点上的措辞时,我们都会生成一个新的 POT 文件,其中包含站点中的所有可翻译字符串。但是,当我们将其与现有 PO 文件合并(使用 POEdit)时,合并过程仅将 POT 条目添加到 PO 文件中。它不会删除我们不再需要的翻译。我们的 PO 文件中有超过 12k 个不需要的翻译。这让我们的翻译很不高兴。她已经开始只查看网站,然后将翻译发送给我以手动添加,这让我非常不高兴。

我四处寻找可以进行这种破坏性合并的工具,但我还没有成功找到一个。在我开始写一篇之前……我错过了什么吗?

(抱歉,如果这属于不同的交易所,如果有人告诉我是哪一个,我会将这篇文章移至更好的交易所)。

translation poedit pot

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

为什么我的嵌套复数 ICU 消息在 React-intl FormattedMessage 中不起作用?

我正在使用react-intl 及其<FormattedMessage />标签。

我想要一个结构化消息,它将根据提供的值选择正确的复数变体,以允许翻译人员使用其语言规则,即,如果他们有“一个”、“两个”、“许多”的不同变体,我不想通过switch仅使用英语规则“零”、“一”和“其他”的语句将其硬编码在应用程序业务逻辑内部。

<FormattedMessage id="myMessage" values={{applesCount: 4, orangesCount: 0, pearsCount: 1}} />I have some apples and some pears应该从以下来源 产生。

由于某些原因,它返回I have some apples, some pears, and some oranges

{applesCount, plural, 
    zero {{pearsCount, plural, 
        zero {{orangesCount, plural, 
            zero {I have no fruit}
            other {I have some oranges}
        }}
        other {{orangesCount, plural, 
            zero {I have some pears}
            other {I have some pears and some oranges}
        }}
    }}
    other {{pearsCount, plural, 
        zero {{orangesCount, plural, 
            zero …
Run Code Online (Sandbox Code Playgroud)

translation localization icu reactjs react-intl

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

批量翻译的 IAM 权限问题:PermissionDenied:403 Cloud IAM 权限“cloudtranslate.generalModels.batchPredict”被拒绝

这是我第一次运行谷歌批量翻译,我通常运行API翻译,但这次我的文件太大,无法以这种方式翻译。

我尝试运行以下脚本,但收到下面的权限错误,我不知道如何继续。任何帮助深表感谢..

from google.cloud import translate

os.environ["GOOGLE_APPLICATION_CREDENTIALS"]= r"C:\Users\..my_path..\cred.json"
# translate_client = translate.Client()

def batch_translate_text(
    input_uri="gs://....",
    output_uri="gs://....",
    project_id="....",
    timeout=180):
    """Translates a batch of texts on GCS and stores the result in a GCS location."""

    client = translate.TranslationServiceClient()

    location = "us-central1"
    # Supported file types: https://cloud.google.com/translate/docs/supported-formats
    gcs_source = {"input_uri": input_uri}

    input_configs_element = {
        "gcs_source": gcs_source,
        "mime_type": "text/plain",  # Can be "text/plain" or "text/html".
    }
    gcs_destination = {"output_uri_prefix": output_uri}
    output_config = {"gcs_destination": gcs_destination}
    parent = f"projects/{project_id}/locations/{location}"

    # Supported language codes: https://cloud.google.com/translate/docs/language
    operation = …
Run Code Online (Sandbox Code Playgroud)

python translation google-cloud-platform

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

翻译不可读的俄语文本

我正在尝试阅读我认为是俄语的文档,但我不确定我所看到的是否正确编码.文字看起来像这样:

Ãåíåðèðóåòìàòðèöóñëó÷àéíûõ÷èñåëâäèàïàçîíåîò-1äî1

(显示为几个特殊的A和o)

在Firefox中打开时.在其他程序中,它看起来像这样:

-1 1

(显示为几个问号)

有没有希望翻译这个?

unicode translation character-encoding

0
推荐指数
1
解决办法
1241
查看次数

C++矢量元素计数

在C++中,使用矢量头,如何找到元素的数量?

#include <iostream>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <vector>
using namespace std;
int primer(int max);
int main()
{
    system("pause");
    return 0;
    primer(1000);
}

int primer(int max){
    vector<int> a;
    a[1]=2;
    for (int i=2;i<=max;i++){
    bool prime=true;
    for (int ii=1;ii<=#a;ii++) {
    if i/a[ii]==math.floor(i/a[ii]) {
    prime=false;
    }
    }
    if prime==true {
    a[#a+1]=i;
    }
    }
    for (i=1;i<=#a;i++) {
    cout << a[i]);
    }
}
}
Run Code Online (Sandbox Code Playgroud)

我最初为lua编写代码,这是我尝试将其转换为C++.我会很感激细节,例如,对坏线的特定替代品.我试图用a.size替换#a,但它没有用.

修订:

#include <iostream>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <vector>
using namespace std;
int primer(int max);
int …
Run Code Online (Sandbox Code Playgroud)

c++ primes translation

0
推荐指数
2
解决办法
4903
查看次数

Delphi等效的C代码

自从我写了一段C代码以来,我已经很久了.有谁知道如何将这段代码翻译成Delphi 2010?

char * pAlignedBuf = (char *) ((int(buf) + 7) & ~7);
Run Code Online (Sandbox Code Playgroud)

buf在哪里char * buf.

我知道,char *Pchar的,但我不知道是什么&~7是.

c delphi translation delphi-2010

0
推荐指数
1
解决办法
351
查看次数

如何以编程方式查找英语单词的翻译到其他语言

以下是一组翻译示例 english --> french

lundi (monday)
mardi (tuesday)
mercredi (wednesday)
janvier (january)
Run Code Online (Sandbox Code Playgroud)

有没有一种更简单的方法可以找到几天和几个月的同等单词,从英语到法语| 德国人| 日本?

java translation

0
推荐指数
1
解决办法
326
查看次数

从Perl到Python的翻译,简要介绍

我真的需要帮助.我尝试将这个Perl翻译成Python,但它似乎没有做我想要的.

谢谢!

Perl的:

@X_max = &MaxValue(@xCoords);
     $maxX = int(10 * $X_max[0]/5);
    @X_min = &MinValue(@xCoords);
    $minX =  int(10 * $X_min[0]/5);
    $rangeX = &Range($minX, $maxX);
    print GRID "X:\t $maxX\t $minX\t\t $rangeX\n";
Run Code Online (Sandbox Code Playgroud)

Python(到目前为止):

_max = max(xCoords) 
max(X) = int(10 * max((X)0/5))
X_min = min(xcoords)
min(X) = int(10 * min((X)0/5))
range(X) = range(min(X), max(X))
print('X:') ('%4s') % min, '%15s' % max, '%25s' % range
Run Code Online (Sandbox Code Playgroud)

python perl translation range min

0
推荐指数
1
解决办法
192
查看次数

Objective-C到Swift翻译问题

我正在尝试将这个简单的代码行转换为Swift,但无法弄清楚如何编写它:

AVCaptureConnection *videoConnection = nil;
Run Code Online (Sandbox Code Playgroud)

我试过了:

    let videoConnection: AVCaptureConnection = nil

    let videoConnection: AVCaptureConnection = false

    var videoConnection:AVCaptureConnection = AVCaptureConnection()
            videoConnection = nil

    var videoConnection:AVCaptureConnection = AVCaptureConnection()
            videoConnection = false

var videoConnection:AVCaptureConnection = AVCaptureConnection()
            videoConnection.active = false

var videoConnection:AVCaptureConnection = AVCaptureConnection()
            videoConnection.active = nil
Run Code Online (Sandbox Code Playgroud)

关于如何写这个的任何建议是Swift将不胜感激.

translation objective-c avcapturesession swift

0
推荐指数
1
解决办法
74
查看次数

困惑于简单的汇编代码(IA32)

考虑以下C函数:

void f1(int i) 
{ 
    int j=i+a; 
}

int f2(int i) 
{
    return i+a; 
}
Run Code Online (Sandbox Code Playgroud)

以及汇编语言的翻译(由讲师给出):

#f1 translation :

subl $8, %esp 
movl 12(%esp), %eax 
movl %eax, 4(%esp) 
movl 4(%esp), %eax 
addl a, %eax 
movl %eax, (%esp) 
addl $8, %esp 
ret

#f2 translation :

subl $8, %esp 
movl 12(%esp), %eax 
movl %eax, 4(%esp) 
movl a, %eax 
movl %eax, (%esp) 
movl (%esp), %eax 
addl 4(%esp), %eax 
addl $8, %esp 
ret
Run Code Online (Sandbox Code Playgroud)

我试图绘制并记下两个汇编代码的每一步,但我根本无法看到两者如何导致不同的C代码.

按照惯例,寄存器%eax包含函数的返回值.如果我没弄错,寄存器%eax包含两个汇编代码末尾的值(i …

c assembly translation

0
推荐指数
1
解决办法
142
查看次数