GitHub search allows filtering repositories by language. How can I set a repository to a specific language?
asked Nov 28, 2012 at 4:34
1
You can also override certain files
$ cat .gitattributes
*.rb linguist-language=Java
Source
6
It is purely deduced from the code content.
As Pedro mentions:
Please note that we count the total bytes of each language’s file (we check the extension) to decide the percentages.
This means that if you see your project reported a JavaScript, but you swear you use Ruby, you probably have a JS lib somewhere that is bigger than your Ruby code
As detailed in «GitHub changes repository to the wrong language», you can add a .gitattributes
file in which you can:
-
ignore part of your project (not considered for language detection)
static/* linguist-vendored
-
consider part of your project as documentation:
docs/* linguist-documentation
-
indicate some files with specific extension (for instance
*.rb
) should be considered a specific language:*.rb linguist-language=Java
answered Nov 28, 2012 at 7:14
VonCVonC
1.2m508 gold badges4248 silver badges5069 bronze badges
2
You can also make some of the files vendor
-ed. Just create a .gitattributes
file in the main directory. If you want to exclude CSS from the language statistics write into the file something like this.
client/stylesheets/* linguist-vendored
This will hide all files in the client/stylesheets/
from the language statistics. In my case these are the .css files.
This solves your problem partly, because hides the most used language and choose the second one to be prime.
answered Apr 22, 2016 at 14:07
KasmetskiKasmetski
6876 silver badges10 bronze badges
0
A bit brute-force, but I used this .gitattributes file:
* linguist-vendored
*.js linguist-vendored=false
It says to ignore all files except .js, so JavaScript becomes the only possible language. My project, https://github.com/aim12340/jQuery-Before-Ready, was listed as HTML and this changed it to JavaScript.
answered Apr 20, 2017 at 13:19
EamonnMEamonnM
2,1211 gold badge12 silver badges18 bronze badges
As VonC mentioned in the comments, you can put your libraries under «vendors» or «thirdparty» and the files won’t be analysed by linguist, the tool GitHub uses to analyse the language in your code.
# Vendored dependencies
- third[-_]?party/
- 3rd[-_]?party/
- vendors?/
- extern(al)?/
Later, they added more folder names.
answered Feb 24, 2014 at 13:47
NicolasNicolas
1,12512 silver badges20 bronze badges
3
Create .gitattributes file in the root of your folder.
Suppose you want the language to be Java, just copy-paste
*.java linguist-detectable=true
*.js linguist-detectable=false
*.html linguist-detectable=false
*.xml linguist-detectable=false
in the .gitattributes file and push the file in the repository. Reload your GitHub page to see the language change.
For reference, use this GitHub repository.
insolor
4049 silver badges16 bronze badges
answered Aug 15, 2019 at 4:03
Saif SiddiquiSaif Siddiqui
7781 gold badge12 silver badges33 bronze badges
Rename the name of the code files in your repository with the extension added.
For example:
- change abc to abc.py for Python
- abc to abc.java for Java files
- abc to abc.html for HTML
answered Nov 13, 2016 at 12:53
1
Русификация GitHub. Кто-нибудь пытался это сделать через Userscript?
Многим известен дикий фейл гитхаба по интернационализации.
Посему хочу узнать, есть ли в природе проект интернационализации web-интерфейса GitHub-а через Userscript?
1. Руссификация. 2. А зачем? Кому нужен этот русский язык?
2. А зачем? Кому нужен этот русский язык?
А термины типа stage, rebase, cherry pick тоже на русском? Я это в страшном кошмаре видел. и немного наяву, когда git gui у меня подцепил немецкую локаль. Сначала локализация, а потом что, именование бранчей на русском. или нет, транслитом? Нее, не нужно 🙂
Больше того скажу, если человек не знает английского, то и он в программировании не нужен.
2. А зачем? Кому нужен этот русский язык?
Т.е. русификация нужна кретинам?
Где-то полгода назад (а может и больше) на гитхабе вроде был какой-то русский интерфейс, а также там был опрос, нужна ли русификация интерфейса.
Я разумеется ответил «Нет» и включил английский.
Да я тоже фигею с любителей говностандартов, в данном случае — бритосский. Выбор, конечно, не велик, но зачем-то ведут себя как пользователи эппла.
поиск GitHub позволяет фильтровать репозитории по языку. Как установить репозиторий на определенный язык?
6 ответов
Как упоминалось в комментариях VonC, вы можете поместить свои библиотеки под «поставщиками» или «третьей стороной», и файлы не будут проанализированы лингвист, инструмент GitHub использует для анализа языка в вашем коде.
обновление: Они добавили больше имен папок
вы также можете переопределить определенные файлы
это чисто выводится из содержимого кода.
обратите внимание, что мы подсчитываем общее количество байтов файла каждого языка (мы проверяем расширение), чтобы решить проценты.
Это означает, что если вы видите, что ваш проект сообщил JavaScript, но вы клянетесь, что используете Ruby, у вас, вероятно, есть JS lib где-то больше, чем ваш Ruby code
как указано в «GitHub меняет репозиторий на неправильный язык», вы можете добавить .gitattributes файл, в котором вы можете:
игнорировать часть вашего проекта (не учитывается для определения языка)
считают частью проекта документации:
указать некоторые файлы с определенным расширением (например *.rb ) следует считать конкретным язык:
вы также можете сделать некоторые файлы vendor -ed. Просто создайте .gitattributes файл в главном каталоге. Если вы хотите исключить CSS из статистики язык записать в файл что-то вроде этого. client/stylesheets/* linguist-vendored
это скроет все файлы в client/stylesheets/ из статистики язык. В моем случае это .файл CSS.
это частично решает вашу проблему, потому что скрывает наиболее используемый язык и выбирает второй, чтобы быть простым.
немного грубой силы, но я использовал это .gitattributes file:
Он говорит, чтобы игнорировать все файлы, за исключением .js, поэтому JavaScript становится единственным возможным языком. Мой проект https://github.com/aim12340/jQuery-Before-Ready был указан как HTML, и это изменило его на JavaScript
переименуйте имя файлов кода в вашем репозитории с добавленным расширением.
GitHub in your language
Today, thanks to our great community, we’re turning on a number of languages that you can view GitHub in other than English.
You will now see links to these languages in the footer of each GitHub page. Just click on one of the languages to switch to it – it will store your language choice in your session. If your browser has the Accept-Language header set and you have not selected a language choice yet, we’ll prompt at the top of the page if you want us to switch to that language.
Not all of the site is translated, but hopefully most of the really important parts are and we’ll work on getting even more of it done in the near future.
Some of these translations are still a bit rough – if you want to comment on them or suggest improvements or sections of the site that should be translated next there is a Google Group here.
I recently organized my pinned repositories on GitHub and noticed that the language shown for one of my repositories didn’t quite seem right. It indicated HTML
but I was expecting JavaScript
because it was a vanilla JavaScript frontend and there were more lines of JavaScript code than HTML.
To really set the scene, here’s a screenshot of my pinned repos with the incorrectly labeled repo (IMO) in question:
I did some digging to figure out how GitHub determines the language for the repository as well as looking at how I can change the language shown.
GitHub and the Linguist Library
GitHub indicates it uses the open source Linguist Library to determine the file language for syntax highlighting and repository statistics.
Once you push changes to a repository on GitHub, the Linguist does its thing with a low-priority background job that will go through all of the files to determine the language of each file. Some things to note:
- all of the languages it knows about are listed in languages.yml
- excluded files include binary data, vendored code, generates code, documentation, files with either
data
(ie SQL) orprose
(ie Markdown) languages, and explicit language overrides.
To determine the language for each remaining file, the Linguist employs the seven strategies listed below, done in the same order. Each step will either identify the exact language or will reduce the number of possible languages that get passed down to the next strategy.
- Vim or Emacs modeline
- commonly used filename
- shell shebang
- file extension
- XML header
- heuristics
- naïve Bayesian classification
The results are then used to produce the language stats bar that shows the languages and its respective percentages that make up the repository. The percentage is determined by the bytes of code for each language as indicated by the List Languages API. The language shown for all of my pinned repos up top is the majority language.
Also, I was today years old when I found about the language stats bar. If you’re wondering where it is, it’s the colorful bar up at the top of your repository just under the commits/branches/etc. bar. Those colors indicate the languages that make up your repo, and click on it to get the full breakdown. 🤯
Changing the Repo Language Shown
Now that we know the background of how GitHub determines the repository language, I’ll show you how to change the language shown using gitattributes
.
- Create a
.gitattributes
file in your repo at the top-level -
Edit the file and add the below line, subbing in the language(s) you want ignored denoted by its file extension before
linguist-detectable=false
. Since I want HTML ignored, I’ve included HTML below.*.html linguist-detectable=false
-
Add, commit, and push the changes
And voila, the language is changed to JavaScript!
Resources
About Repository Languages
Linguist
How Do I Change the Category?
I’ve noticed that Github picked JavaScript as the language for my Django app:
Is it possible to change it to Python? Or do I need to make a new repository?
Solved:
As @Geno Chen said, to change the repository language we have to add the file .gitattributes containing this code:
# to change language of repo from Javascript to Python
*.js linguist-language=Python
Kin
1,40510 silver badges16 bronze badges
asked Mar 1, 2019 at 14:02
3
The language detector stats the programs in your projects and shows the result with the ratio. If your repository have detected a wrong language, you can follow the tutorial, most of the time you just need to override the result with a .gitattributes
in the repository root containing something like the sample from tutorial, to manually pull up the ratio of specific programming language:
# Example of a `.gitattributes` file which reclassifies `.rb` files as Java:
*.rb linguist-language=Java
answered Mar 1, 2019 at 14:14
Geno ChenGeno Chen
4,6576 gold badges22 silver badges39 bronze badges
3
Create a new file in your repo and name it to .gitattributes
. After that make sure you set linguist-detectable
to true
like this:
*.css linguist-detectable=false
*.java linguist-detectable=false
*.python linguist-detectable=true
*.js linguist-detectable=false
*.html linguist-detectable=false
*.xml linguist-detectable=false
answered Jun 4, 2020 at 23:56
Mo FatahMo Fatah
1391 silver badge10 bronze badges
2
I’ve noticed that Github picked JavaScript as the language for my Django app:
Is it possible to change it to Python? Or do I need to make a new repository?
Solved:
As @Geno Chen said, to change the repository language we have to add the file .gitattributes containing this code:
# to change language of repo from Javascript to Python
*.js linguist-language=Python
Kin
1,40510 silver badges16 bronze badges
asked Mar 1, 2019 at 14:02
3
The language detector stats the programs in your projects and shows the result with the ratio. If your repository have detected a wrong language, you can follow the tutorial, most of the time you just need to override the result with a .gitattributes
in the repository root containing something like the sample from tutorial, to manually pull up the ratio of specific programming language:
# Example of a `.gitattributes` file which reclassifies `.rb` files as Java:
*.rb linguist-language=Java
answered Mar 1, 2019 at 14:14
Geno ChenGeno Chen
4,6576 gold badges22 silver badges39 bronze badges
3
Create a new file in your repo and name it to .gitattributes
. After that make sure you set linguist-detectable
to true
like this:
*.css linguist-detectable=false
*.java linguist-detectable=false
*.python linguist-detectable=true
*.js linguist-detectable=false
*.html linguist-detectable=false
*.xml linguist-detectable=false
answered Jun 4, 2020 at 23:56
Mo FatahMo Fatah
1391 silver badge10 bronze badges
2
Invision Community — Русский языковой пакет
Это профессиональная локализация Invision Community 4 на русский язык. Моей целью было сделать универсальную русификацию, подходящую как можно большему количеству сайтов. Поэтому она бесплатна, и не содержит никаких скрытых ссылок и рекламы.
Преимущества моего перевода
В каждой новой версии Invision Community разработчики производят изменения в языковых строках. Я поддерживаю перевод в актуальном состоянии, обновляя его в течение нескольких суток после выхода новой версии системы. Поэтому большинство русскоязычных сайтов на Invision Community используют данный перевод.
Участие в переводе и ошибки
Весь процесс перевода осуществляется в специальном репозитории на GitHub.
Если вы хотите сообщить о найденной ошибке, опечатке или неточности в переводе, или просто хотите внести предложение по улучшению русификации, то я буду рад, если вы сделаете это в разделе Issues репозитория. Таким образом ваше сообщение не затеряется и будет обработано в кратчайшие сроки.
Инструкция по установке
- Скачайте xml-файл с русификацией, он содержит перевод всех официальных приложений.
- На сайте перейдите в AdminCP → Customization → Languages и нажмите кнопку Create New.
- Нажмите на ссылку manual upload и выберите файл Russian.Language.Pack.xml.
- В списке Locale выберите Русский (Россия), нажмите кнопку Save и ждите завершения.
- Напротив языка Русский (RU) нажмите кнопку Edit, отметьте переключатель Default Language? и нажмите Save.
- В Админцентре нажмите на свою аватарку сверху-справа, зайдите в AdminCP Language и выберите Русский (RU).
Инструкция по обновлению
- Скачайте архив с переводом и распакуйте его в любую папку.
- На сайте перейдите в Админцентр → Внешний вид → Языки и найдите Русский (RU).
- Напротив языка Русский (RU) откройте меню и выберите Загрузить новую версию.
- Выберите файл Russian.Language.Pack.xml и нажмите кнопку Сохранить.
Официальный сайт
Все мои работы по Invision Community и другим системам можете найти на сайте https://ipshelp.ru.