このストーリーの筋書きは、iOSプラットフォーム用に当社のJivoの製品タスクの1つを実装する機会があったときに開発されました。しかし、私は簡単な紹介から始めます。
ローカリゼーションは、モバイル開発で頻繁に議論されるトピックの1つです。
主にiOSプラットフォームに関するこのトピックでは、次の側面が影響を受けます。
翻訳の編成と同期を簡素化するサービス。
xibファイルを翻訳するためのベストプラクティス。
翻訳検証用の補助コンパイル時アドイン。
しかし、私たちの話はそれについてではありません。翻訳を同期するために、xibファイルではなく、サードパーティのサービスを社内に統合することに成功しました。コードを優先し、コンパイル時のアドオンはまだ使用していません(ただし、実装については考えられています)。
私たちの話は、ある日、文脈によってわずかに変化する意味の同じフレーズの翻訳を実際にやりくりしなければならないという課題に直面する機会があったことについてです。
すべての始まり
当社の製品には、リマインダーを設定する機能があります。リマインダーは、オペレーターが少し後でクライアントに戻りたい場合に役立ちます。たとえば、相談後しばらくしてから追加の質問が発生したかどうかを明確にすることで、忠誠心を高めることができます。特定の時間のリマインダーは、自分自身または別のオペレーターに設定できます。また、必要に応じて、オプションでテキストコメント(説明)を指定できます。
もちろん、そのようなリマインダーを設定するという事実は、システムメッセージによってダイアログテープに複製されます。そして、問題が発見されたのはまさにここでした。リマインダーの構成に応じて、情報ラベルは完全に異なって見える場合があります。例(英語版のインターフェースから):
◼︎ You created the reminder for agent Alex on 08/29/20 at 4:30 PM
◼︎ Agent Nick created the reminder "Ask about any issue happened since our call" on 10/03/20 at 11:30 AM
◼︎ Agent Alex completed the reminder on 12/05/20 at 5:00 PM
, :
◼︎ –
◼︎
◼︎
◼︎ – , ,
, 32 . , , , . , .
, « » , :
// either...
let caption = format(
"REMINDER_CREATE_SELF_FOR_SELF", // !!!
reminder.time)
// or...
let caption = format(
"REMINDER_CREATE_ANOTHER_WITH_COMMENT_FOR_SELF", // !!!
reminder.author.name,
reminder.comment,
reminder.time)
// etc.... , , , . , , . , :
if reminder.author.isMe {
slices += [format("REMINDER_AUTHOR_SELF")]
}
else {
slices += [format("REMINDER_AUTHOR_ANOTHER", reminder.author.name)]
}
if let comment = reminder.comment {
slices += [format("REMINDER_COMMENT", comment)]
}
if reminder.target.isMe {
slices += [format("REMINDER_FOR_SELF")]
}
else {
slices += [format("REMINDER_FOR_ANOTHER", reminder.target.name)]
}
slices += [format("REMINDER_TIME", reminder.time)]
let caption = slices.joined(), - . .
. bb- , . , , , . « ».
( ). , , .
– , , $creatorName, , .
– , , $[Agent $creatorName ## You]; - Agent $creatorName You, ##; , ; . , , ( ) ; .
– , , , $[Agent $creatorName ## :another: Another agent ## You]; - Agent $creatorName, Another agent You; Another agent another, , , ( ).
. , :
◼︎ Agent Nick created the reminder on 10/03/20 at 11:30 AM
◼︎ You created the reminder "Ask about any issue happened since our call" on 10/03/20 at 11:30 AM
◼︎ Agent Nick created the reminder "Ask about any issue happened since our call" on 10/03/20 at 11:30 AM
◼︎ You created the reminder for Alex on 10/03/20 at 11:30 AM
:
$[Agent $creatorName ## You] created the reminder $["$comment"] $[for $targetName] on $date at $time, . , , . , ( Swift, C++, ).
:
let parser = PureParser()
let formula = "$[Agent $creatorName ## You] created the reminder $[\"$comment\"] $[for $targetName] on $date at $time"
parser.assign(variable: "creatorName", value: "Nick")
parser.assign(variable: "date", value: "10/03/20")
parser.assign(variable: "time", value: "11:30 AM")
let result = parser.execute(formula, collapseSpaces: true, resetOnFinish: true)
print(result)
// Agent Nick created the reminder on 10/03/20 at 11:30 AM:
let parser = PureParser()
let formula = "$[Agent $creatorName ## You] created the reminder $[\"$comment\"] $[for $targetName] on $date at $time"
parser.assign(variable: "comment", value: "Ask about any issue happened since our call")
parser.assign(variable: "date", value: "10/03/20")
parser.assign(variable: "time", value: "11:30 AM")
let result = parser.execute(formula, collapseSpaces: true, resetOnFinish: true)
print(result)
// You created the reminder "Ask about any issue happened since our call" on 10/03/20 at 11:30 AM:
let parser = PureParser()
let formula = "$[Agent $creatorName ## You] created the reminder $[\"$comment\"] $[for $targetName] on $date at $time"
parser.assign(variable: "creatorName", value: "Nick")
parser.assign(variable: "comment", value: "Ask about any issue happened since our call")
parser.assign(variable: "date", value: "10/03/20")parser.assign(variable: "time", value: "11:30 AM")
let result = parser.execute(formula, collapseSpaces: true, resetOnFinish: true)
print(result)
// Agent Nick created the reminder "Ask about any issue happened since our call" on 10/03/20 at 11:30 AM:
let parser = PureParser()
let formula = "$[Agent $creatorName ## You] created the reminder $[\"$comment\"] $[for $targetName] on $date at $time"
parser.assign(variable: "targetName", value: "Alex")
parser.assign(variable: "date", value: "10/03/20")
parser.assign(variable: "time", value: "11:30 AM")
let result = parser.execute(formula, collapseSpaces: true, resetOnFinish: true)
print(result)
// You created the reminder for Alex on 10/03/20 at 11:30 AM: ?
let parser = PureParser()
let formula = "$[Agent $creatorName ## :another: Another agent ## You] created the reminder $[\"$comment\"] $[for $targetName] on $date at $time"
parser.activate(alias: "another", true)
parser.assign(variable: "date", value: "10/03/20")
parser.assign(variable: "time", value: "11:30 AM")
let result = parser.execute(formula, collapseSpaces: true, resetOnFinish: true)
print(result)
// Another agent created the reminder on 10/03/20 at 11:30 AM( , , ) , . .

ライブラリはC ++で記述されており、CとSwiftにもラッパーがあります。スウィフトによる接続を提供しCocoaPodsとスウィフトパッケージマネージャ。