metabase / metabase/metabase

Export entities with Cyrillic names

Open
#29,309 1 comment 0 reactions 0 assignees View on GitHub
Customization/i18n Operation/Serialization Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**Is your feature request related to a problem? Please describe.**
When you create a collection with a Cyrillic name, a very long slug is automatically created for it.

``` clojure
{:slug "%D0%BA%D0%BE%D0%BB%D0%BB%D0%B5%D0%BA%D1%86%D0%B8%D1%8F_%D0%BD%D0%B0_%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%BE%D0%BC_%D1%8F%D0%B7%D1%8B%D0%BA%D0%B5"
:name "Коллекция на русском языке"
:entity_id "rPc-IhBbXPnwulgHLr3Lf"}
```
Where `:name` length is **26 chars** and `:slug` length is **141 chars**

When you try to export this collection to disk:
- in versions before 0.43, the YAML file was not created,
because the name of the resulting file exceeded the maximum allowable size of 255 bytes.
- in later revisions, the entity will be written to disk, but in a completely unreadable format.
Like `rPc-IhBbXPnwulgHLr3Lf_%D0%BA%D0%BE%D0%BB%D0%BB%D0%B5%D0%BA%D1%86%D0%B8%D1%8F_%D0%BD%D0%B0_%D1%80%D1%83%D1%81%D1%81%D0%BA%D.yaml`

This can be critical if you want to keep the dump in the git repository format or share a specific file to import with colleagues.

**Describe the solution you'd like**
I would suggest the transliteration of Cyrillic into Latin.
An example that would improve readability and reduce filename when exporting.

``` clojure
(import '(com.ibm.icu.text Transliterator))
(require '[clojure.test :as t]
'[clojure.string :as str])

(defn slugify [s & [{:keys [lower? punctuation? max-length]
:or {lower? false
punctuation? false
max-length 120}}]]
(let [id (apply
str
(cond-> ["Cyrillic-Latin; "
"Latin-ASCII; "
"[:M:] remove; "]
lower?
(conj "Lower; ")

punctuation?
(conj "[:Punctuation:] remove; ")

:default
(conj "([:Cyrillic:]) ")))]
(when s
(-> (.. Transliterator (getInstance id) (transform s))
(str/trim)
(#(take max-length %))
(str/join)
(str/replace #"\s+" "_")))))

(t/is (= (slugify "Коллекция на русском языке")
"Kollekcia_na_russkom_azyke"))

```

**Describe alternatives you've considered**
I can't think of any alternative solutions

**How important is this feature to you?**
Very important, because there is no way to export the collections with long names in Cyrillic

Referring to this issue
https://github.com/metabase/metabase/issues/29275

Contributor guide

Open the contributing guide

Research direction

Start by reading the related issue #29275 and locating the code that generates filenames when collections are exported to disk. Reproduce the Cyrillic-name case, then inspect existing export tests or add coverage for transliterated filenames. Done means the exported YAML has a readable, filesystem-safe name within the size limit and remains importable.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.