Non-English tickets over English code
At acme, tickets are written in Turkish and the code is in English. A ticket says "iade", the code says refund, and no word of one appears in the other. This guide shows what Safran does about that gap, with real output from a small setup, and how to check whether it helps on your own repositories.
You need two things in the profile: the languages, and a glossary of the words that differ.
version: 1
company: acme
languages:
tickets: tr
code: en
code:
hosts:
- id: azure
type: azure-repos
organization: acme
project: Platform
token_env: AZURE_DEVOPS_PAT
groups:
backend: [payments-api, ledger]
frontend: [web-app, admin-panel]
glossary:
- term: Sepet
code: [basket, cart]
- term: İade
code: [refund, chargeback]
embeddings:
type: ollama
model: bge-m3A worked example
Ticket PAY-1423 is titled "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor". The fix lives in payments-api, in src/refund/service.ts and src/refund/policy.ts. Searching with the title as it is written:
$ safran search "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor" --limit 2
glossary: İade → refund, chargeback
1 payments-api src/refund/policy.ts:1-21
other · RefundRequest, RefundPolicyError, asser… · typescript · score 0.579 (dense 0.569, lexical 0.661)
1 │ export interface RefundRequest {
2 │ paymentId: string;
3 │ amount: number;
4 │ capturedAmount: number;
5 │ alreadyRefunded: number;
6 │ branch: string;
7 │ }
8 │
… 13 more lines (--full, or: safran read payments-api src/refund/policy.ts --lines 1-21)
2 payments-api src/refund/service.ts:1-24
api-service · RefundResult, RefundService, roundToMin… · typescript · score 0.501 (dense 0.521, lexical 0.321)
1 │ import { assertRefundable, type RefundRequest } from "./policy";
2 │
3 │ export interface RefundResult {
4 │ refundId: string;
5 │ amount: number;
6 │ partial: boolean;
7 │ }
8 │
… 16 more lines (--full, or: safran read payments-api src/refund/service.ts --lines 1-24)
2 hits (limit 2; raise it with --limit)The first line is the glossary at work: iade in the query matched the term İade, so refund and chargeback were added to the query before it was searched. --json shows the query that was actually run:
{
"query": "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor",
"effective_query": "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor refund chargeback",
"glossary": [
{
"term": "İade",
"code": [
"refund",
"chargeback"
]
}
]
}(The hits array is left out here.)
Now the same search with the glossary switched off:
$ safran search "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor" --limit 3 --no-glossary
1 payments-api src/webhook/retry.ts:1-13
other · WebhookDelivery, MAX_ATTEMPTS, nextRetr… · typescript · score 0.402 (dense 0.447)
1 │ export interface WebhookDelivery {
2 │ id: string;
3 │ attempt: number;
4 │ idempotencyKey: string;
5 │ }
6 │
7 │ const MAX_ATTEMPTS = 5;
8 │
… 5 more lines (--full, or: safran read payments-api src/webhook/retry.ts --lines 1-13)
2 payments-api src/refund/service.ts:1-24
api-service · RefundResult, RefundService, roundToMin… · typescript · score 0.399 (dense 0.443)
1 │ import { assertRefundable, type RefundRequest } from "./policy";
2 │
3 │ export interface RefundResult {
4 │ refundId: string;
5 │ amount: number;
6 │ partial: boolean;
7 │ }
8 │
… 16 more lines (--full, or: safran read payments-api src/refund/service.ts --lines 1-24)
3 payments-api src/refund/policy.ts:1-21
other · RefundRequest, RefundPolicyError, asser… · typescript · score 0.396 (dense 0.440)
1 │ export interface RefundRequest {
2 │ paymentId: string;
3 │ amount: number;
4 │ capturedAmount: number;
5 │ alreadyRefunded: number;
6 │ branch: string;
7 │ }
8 │
… 13 more lines (--full, or: safran read payments-api src/refund/policy.ts --lines 1-21)
3 hits (limit 3; raise it with --limit)Two things changed. No hit has a lexical score any more, because no Turkish word of the title occurs in the code. And the dense scores of three different files sit within 0.007 of each other (0.447, 0.443, 0.440), with a webhook file on top: the embedding model places the Turkish sentence near payment code in general, but not near the refund files in particular.
Asking only the word channel makes the gap plain:
$ safran search "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor" --mode lexical --no-glossary
No hits.
→ 6 chunks are indexed. Drop filters, try other words, or use `safran grep` for an exact string.Why the gap exists
Safran searches code on two channels and blends them (see search modes):
- The lexical channel matches words. It is exact and needs no model, but a Turkish word can only match where the code contains that very word: in a comment, a string, a test name.
- The dense channel compares embedding vectors, so it can connect a sentence to code that shares no word with it. How well it does that across languages depends entirely on the embedding model, and business vocabulary is where it is weakest: nothing in general language tells a model that acme calls its returns flow
chargeback.
The glossary closes the gap on the query side, with knowledge only your company has.
languages
languages:
tickets: tr
code: enBoth values are two-letter ISO 639-1 codes; both default to en. They describe the company and are used in these places:
get_company_profilereports them to the agent, and the skills of the Claude Code plugin write to the user inlanguages.tickets(see what the skills answer in).- Discovery lower-cases ticket titles by the rules of
languages.ticketsand only looks for glossary candidates when the ticket language differs from the code language. - The golden set of evaluation tags each question with it.
They do not switch code search into another mode. The glossary and the case rules below apply to every query, whatever languages says.
How the glossary bridges it
A glossary entry maps a word people write in tickets to the words the code uses for it:
glossary:
- term: İade
code: [refund, chargeback]
note: Returns flow of the payments teamOn every code search (safran search, safran.code.search, the MCP tool search_code) Safran looks for each term in the query and, for every term found, appends its code words to the query. The index is not changed; expansion is a query-time step, so editing the glossary takes effect on the next search with no re-indexing.
Matching rules
- Case is folded the same way on every machine.
I,İ,ıandiall becomeibefore comparing, then the rest is lower-cased. Soİadematchesiade,İADE, and alsoIADEas it is typed on a keyboard without the dotted capital. A locale-aware lower-casing could not do this: under Turkish rulesIbecomesı, and an English term such asinvoicewould stop matchingINVOICE. - A term must start at a word boundary. The character before the match may not be a letter or a digit.
- Anything may follow. Turkish attaches suffixes, so the term matches as the beginning of a longer word:
iadematchesiadeler,iadenin,iadesi. - Only missing words are added. A
codeword that already occurs in the query is not appended again, and a word shared by two matching terms is added once.
These rules are a prefix match, not grammar. The consequences:
| Query text | Term İade | Why |
|---|---|---|
Kısmi iade işlemi | matches | whole word |
IADELER reddediliyor | matches | case folded, suffix allowed |
İADENİN tutarı | matches | case folded, suffix allowed |
iadesiz | matches | also a prefix, though the word means "without refund" |
kısmiiade | no match | the term is not at the start of a word |
basket total | no match for Sepet | the glossary maps ticket words to code words, not the reverse |
Because of the prefix rule, a very short term matches more than you mean: a term iş would fire on işlemi. Use the full stem people actually write. Sound changes at the end of a stem are not handled either: a term kitap does not match kitabı; add the second form as its own entry if it matters.
Two terms that fold to the same text are rejected when the profile is loaded (duplicate glossary term), so Iade and İade cannot both be entries.
The matcher is exported, so you can test a glossary without an index:
import { expandWithGlossary, matchGlossary, parseProfile } from "@safran/profile";
const profile = parseProfile({
version: 1,
company: "acme",
languages: { tickets: "tr", code: "en" },
glossary: [
{ term: "Sepet", code: ["basket", "cart"] },
{ term: "İade", code: ["refund", "chargeback"] },
],
});
console.log(expandWithGlossary(profile, "Kısmi iade işlemi")); // ["refund", "chargeback"]
console.log(expandWithGlossary(profile, "IADELER reddediliyor")); // ["refund", "chargeback"]
console.log(expandWithGlossary(profile, "Sepetteki ürün")); // ["basket", "cart"]
console.log(expandWithGlossary(profile, "kısmiiade")); // []
console.log(matchGlossary(profile, "sepetim").map((entry) => entry.term)); // ["Sepet"]/**
* Glossary entries whose term occurs in the text as a whole word (or word stem prefix,
* since Turkish and many other languages attach suffixes: "iadeler", "iadenin").
*
* Case is folded with `foldCase` on both sides, not with a locale. Turkish lower-casing turns
* `I` into `ı`, so under it the English term "invoice" never matched "INVOICE", and a profile
* usually holds terms in both languages.
*/
export function matchGlossary(profile: Profile, text: string): GlossaryEntry[];
/** Code-side words for every glossary term found in the text, de-duplicated. */
export function expandWithGlossary(profile: Profile, text: string): string[];defined in packages/profile/src/queries.ts
Seeing and switching the expansion
Every surface reports what was expanded, so a surprising result can be traced:
| Surface | Reports | Switch off |
|---|---|---|
safran search | a glossary: line; effective_query and glossary with --json | --no-glossary |
safran.code.search | effectiveQuery, glossary | expandGlossary: false |
search_code (MCP) | effective_query, glossary_used | expand_glossary: false |
import type { Safran } from "@safran/core";
export async function searchAsWritten(safran: Safran, title: string): Promise<void> {
const expanded = await safran.code.search(title, { groups: ["backend"], limit: 5 });
console.log(expanded.effectiveQuery);
console.log(expanded.glossary.map((entry) => `${entry.term} → ${entry.code.join(", ")}`));
// The same query exactly as written, for comparison.
const plain = await safran.code.search(title, { groups: ["backend"], limit: 5, expandGlossary: false });
console.log(plain.hits.map((hit) => `${hit.repo}/${hit.path}`));
}safran grep and grep_code look for an exact string and never expand anything. Writing and maintaining entries is covered in The glossary.
The default embedder
A profile without an embeddings: section uses type: ollama with the model bge-m3, served by a local Ollama at http://localhost:11434. What the source says about it is short: the plugin describes itself as "Local embeddings via Ollama (default model: bge-m3, multilingual)", and with it nothing leaves the machine. Safran makes no claim of its own about how well this or any model handles a particular language; that is what the evaluation below is for.
Two practical points:
safran doctormakes one small call to the embedder and tells you whether it answers and with how many dimensions.- Vectors of different models are never mixed. If you change
embeddings:to try another multilingual model, search refuses the repos built with the old one (INDEX_NOT_READY) untilsafran synchas re-indexed them; lexical search, grep and reading files keep working meanwhile. See Keeping the index fresh and the Ollama and OpenAI-compatible connector pages.
Search modes and when each helps
--mode (CLI), mode (SDK and MCP) chooses how the two channels are weighted in the final score. The weights are named constants in the code index:
| Mode | Dense weight | Use it when |
|---|---|---|
auto (default) | 0.9 for prose, 0.35 for an identifier-shaped query | Almost always |
hybrid | 0.5 | You want an even blend. The source notes this value was not a measured setting |
dense | 1 | You want meaning only, for example to see what the model does with a sentence on its own |
lexical | 0 | You know a word that is in the code, or the embedder is unavailable |
auto decides from the shape of the query, not from its language. A query counts as identifier-shaped when it has at most two words and one of them looks like a symbol: a camelCase hump, a capitalised ASCII start, an underscore or a dot (RefundService, refund_policy, basket.total). Everything else is prose and leans on the dense channel.
For non-English tickets this means:
- A pasted ticket title is prose, so the dense channel leads and the glossary words give the lexical channel something to hold on to. In the worked example, the lexical scores (0.661 and 0.321) are what separated the two refund files from the rest.
- Lexical search over English code needs English words. Without the glossary, the Turkish title found nothing at all. With it,
--mode lexicalfinds the refund files throughrefundandchargebackalone:
$ safran search "IADELER neden reddediliyor" --limit 1 --mode lexical
glossary: İade → refund, chargeback
1 payments-api src/refund/policy.ts:1-21
other · RefundRequest, RefundPolicyError, asser… · typescript · score 0.661 (lexical 0.661)
1 │ export interface RefundRequest {
2 │ paymentId: string;
3 │ amount: number;
4 │ capturedAmount: number;
5 │ alreadyRefunded: number;
6 │ branch: string;
7 │ }
8 │
… 13 more lines (--full, or: safran read payments-api src/refund/policy.ts --lines 1-21)
1 hit (limit 1; raise it with --limit)- Turkish words that are in the code are found as typed. For the word channel,
İandıare folded toiin both the indexed text and the query, so a word in a comment or a UI string matches whether it was typed with a dotted or a dotless i (sipariş,sıparış). - Scores are comparable within one result list only. Do not compare a score from a Turkish query with one from an English query.
How discovery proposes glossary candidates
You do not have to start the glossary from a blank page. safran discover reads ticket titles and the merged pull requests that reference those tickets, and proposes candidates in safran.draft.yaml. It works by counting, with no language model:
- It collects words that recur in ticket titles and groups inflected forms under one stem (
iadeler,iadenin→iade). - It drops words the code already uses: there is nothing to map.
- For each remaining term it looks at the paths its pull requests changed and keeps path words that stand out against the other pull requests in the same repositories.
The source describes the result plainly: this is co-occurrence, not translation; expect a minority of real terms to be found and some wrong pairs among them. Every candidate is marked low or medium confidence, never high, and carries a note saying where it came from. Terms already in your glossary are not proposed again.
Limits specific to language:
- Candidates are only looked for when the ticket language differs from the code language. With both
en, the step reports that there is nothing to map. - When
languages.ticketsis not set, the language of the titles is guessed, and the guess only tells Turkish, English and "other" apart. For any other language, setlanguages.ticketsyourself before running discovery. safran discover --no-glossaryskips the step.
Thresholds, the findings list and how to review a draft are in Discovery.
Measuring the effect
Whether a glossary helps on your code is a question with a measurable answer. Build a golden set from merged pull requests (question: the ticket title; answer: the files the change touched), then run the same queries with and without expansion:
safran links refresh
safran eval golden
safran eval retrieval --config with=auto --config without=auto,noglossaryEach --config is name=mode, optionally followed by ,noglossary. On the small example setup, with the test tracker and code host that carry PAY-1423 and PAY-1500:
$ safran eval retrieval --config with=auto --config without=auto,noglossary
2 items from /work/acme/data/eval/golden.json · index ollama:bge-m3, 6 chunks · 96 ms
Retrieval evaluation: 2 golden items, 2 configurations, k = 10
config slice n err hit@1 hit@5 hit@10 recall@10 MRR nDCG@10 p50 ms p95 ms
------- -------------- - --- ----- ----- ------ --------- ----- ------- ------ ------
with overall 2 0 1.000 1.000 1.000 1.000 1.000 1.000 8.1 15
with group: backend 2 0 1.000 1.000 1.000 1.000 1.000 1.000 8.1 15
without overall 2 0 0.500 1.000 1.000 1.000 0.750 0.847 0.3 0.4
without group: backend 2 0 0.500 1.000 1.000 1.000 0.750 0.847 0.3 0.4
Too few paired queries to compare "with" and "without" (n = 2, at least 10 needed). No difference is claimed.
n = queries scored; err = failed searches, excluded from the means.Read the sentence under the table. With two questions the tool refuses to call the difference real, and so should you. On a real golden set the summary compares the two configurations with a paired bootstrap and says either which one is better or that there is no significant difference.
Use it as a routine: run it after every batch of glossary edits. An entry that maps a common ticket word to a common code word can pull unrelated files up, and that shows up here as a drop, not in a single search you happen to try. The metrics, the significance check and the caveats of a golden set built from history are explained in Evaluation.
What language the skills answer in
The skills of the Claude Code plugin call get_company_profile first and take two things from languages:
- They write to the user in
languages.tickets, unless the user is writing in another language; then they follow the user. languages.codeis the language of identifiers. Code identifiers, paths and quoted source stay exactly as they are in the code.- Ticket text a skill drafts follows what the profile's
conventionssay about titles and descriptions; when they say nothing, it is written inlanguages.tickets.
The technical-analysis report uses languages.tickets as its report language; its fixed labels are built in for English and Turkish, and other languages can override them. Details are on the plugin and technical analysis pages.
Ticket search is a different matter from code search: search_tickets and safran tickets send your words to the tracker, which matches them against titles and descriptions in the language they were written in. Search tickets with the ticket-side word (iade), code with either.
Common mistakes
| Symptom | Cause | Fix |
|---|---|---|
No glossary: line although the query contains the word | The word in the query is not at a word start, or the entry is written with a different stem | Check with expandWithGlossary; write the stem people use |
| The glossary fires on unrelated queries | The term is too short and matches as a prefix of other words | Lengthen the term |
duplicate glossary term when loading the profile | Two terms differ only in case or in dotted/dotless i | Merge them into one entry |
safran search --mode lexical finds nothing for a ticket title | No word of the title is in the code and no glossary term matched | Add glossary entries, or use auto |
| Discovery proposes no glossary candidates | languages.tickets equals languages.code, or there is too little linked history | Set languages, run safran links refresh, read the findings |
INDEX_NOT_READY after trying another embedding model | The index still holds the old model's vectors | safran sync, or switch embeddings: back |