-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translation of “04-05 External dependencies” #76
Translation of “04-05 External dependencies” #76
Conversation
translation by @roman01la |
|
||
In some circumstances you may found yourself that you need some library but that does not exists in _ClojureScript_ but it is already implemented in javascript and you want to use it on your project. | ||
За певних обставин вам може знадобитися можливості бібліотеки, написаної на JavaScript, для якої немає аналогу в ClojureScript. Тобто вам потрібна можливість підключити таку бібліотеку у проект. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можливість
Тобто,(!) вам потрібна можливість внести таку бібліотеку в проект
|
||
There are many ways that you can do it mainly depending on the library that you want to include. Let see some ways. | ||
В залежності від бібліотеки спрособів підключення може бути багато. Розглянемо деякі з них. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В залежності від бібліотеки,(!)
|
||
If you have a library that is just written to be compatible with google closure module system and you want to include it on your project you should just put it in the source (classpath) and access it like any other clojure namespace. | ||
Якщо бібліотека сумісна з системою модулів в Google Closure Library, вам потрібно лише покласти її в проект поряд з вашим кодом і звернутися до неї через простір імен так само, як це роблять з просторами імен в ClojureScript. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вам потрібно лише додати її до проекту
|
||
This is the most simplest case, because google closure modules are directly compatible and you can mix your clojure code with javascript code written using google closure module system without any additional steps. | ||
Це найпростіший спосіб, бо модулі Google Closure напряму сумісні з ClojureScript і ви спокійно можете використовувати їх у вашому коді. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сумісні з кложуре,(!) і ви
|
||
Open `scripts/repl.clj` and modify it to somethig like this: | ||
Відкрийте файл `scripts/repl.clj` та замінять його вміст на цей: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
замініть
|
||
In order to use a library that exposes a global object, you should follow similar steps as with commojs modules with the exception that you should omit the `:module-type` attribute. | ||
Для використання бібіліотек, які використовують глобальні обʼєкти, слід створити конфігурацію, схожу на ту, що використовується для модулів CommonJS, але в описі модуля не треба вказувати поле `:module-type`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
конфігурацію схожу на ту (без коми)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
з комою, бо відокремлюване означення
|
||
In some circumstances you may found yourself that you need some library but that does not exists in _ClojureScript_ but it is already implemented in javascript and you want to use it on your project. | ||
За певних обставин вам може знадобитися можливості бібліотеки, написаної на JavaScript, для якої немає аналогу в ClojureScript. Тобто вам потрібна можливість підключити таку бібліотеку у проект. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
може знадобитися можливості
можуть
для якої немає аналогу в ClojureScript
аналогу якої немає в ClojureScript
не розділяйте на речення:
... СlojureScript, тобто вам буде потрібно підключити таку бібліотеку у проект.
|
||
There are many ways that you can do it mainly depending on the library that you want to include. Let see some ways. | ||
В залежності від бібліотеки спрособів підключення може бути багато. Розглянемо деякі з них. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Залежно від бібліотеки способів
|
||
This is the most simplest case, because google closure modules are directly compatible and you can mix your clojure code with javascript code written using google closure module system without any additional steps. | ||
Це найпростіший спосіб, бо модулі Google Closure напряму сумісні з ClojureScript і ви спокійно можете використовувати їх у вашому коді. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClojureScript, і ви спокійно (кома)
|
||
```shell | ||
lein new mies myextmods | ||
cd myextmods | ||
``` | ||
|
||
Create a simple google closure module for experiment: | ||
Далі створіть модуль Google Closure для експременту: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
експерименту
|
||
```clojure | ||
(require '[myextmods.myclosuremodule :as cm]) | ||
(cm/get_greetings) | ||
;; => "Hello from google closure module." | ||
``` | ||
|
||
NOTE: you can open the nodejs repl just executing `./scripts/repl` on the root of the repository. | ||
> ЗАУВАЖЕННЯ: ви можете відкрити ClojureScript REPL в Node.js виконавши скрипт `./scripts/repl`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в Node.js, виконавши (кома)
|
||
Open `scripts/repl.clj` and modify it to somethig like this: | ||
Відкрийте файл `scripts/repl.clj` та замінять його вміст на цей: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
замініть
@@ -78,9 +77,9 @@ Open `scripts/repl.clj` and modify it to somethig like this: | |||
:cache-analysis false) | |||
``` | |||
|
|||
NOTE: Although the direct path is used to point to this pet library you can specify a full URI to remote resource and it will be automatically downloaded. | |||
> ЗАУВАЖЕННЯ: Шлях до файлу модуля може бути не тільки локальним, а й посиланням на файл на іншому веб-сервері, який автоматично буде завантажений. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ЗАУВАЖЕННЯ: Шлях до файлу модуля може бути не тільки локальним, а й у вигляді посилання на файл на іншому веб-сервері, який завантажиться автоматично.
|
||
Although today is very common have libraries packaged using some kind of modules, there are also a great amount of libraries that just exposes a global objects and does not uses any kind of modules; and you may want to use them from _ClojureScript_. | ||
Хоча сьогодні за зазвичай бібліотеки побудовані з використанням модулів, все ще існують такі, що не використовують їх, а просто експортують глобальний об'єкт; і у вас може виникнути необхідність використовувати їх в _ClojureScript_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хоча сьогодні більшість бібліотек побудована з використанням модулів, все ще існують такі, що просто експортують глобальний об'єкт. У вас може виникнути необхідність використовувати їх в ClojureScript.
|
||
In order to use a library that exposes a global object, you should follow similar steps as with commojs modules with the exception that you should omit the `:module-type` attribute. | ||
Для використання бібіліотек, які використовують глобальні обʼєкти, слід створити конфігурацію, схожу на ту, що використовується для модулів CommonJS, але в описі модуля не треба вказувати поле `:module-type`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Для застосування бібіліотек, які використовують глобальні обʼєкти, слід створити конфігурацію, схожу на ту, що потрібна для модулів CommonJS. Відмінністю буде те, що в описі модуля не потрібно вказувати поле :module-type
.
|
||
In order to use a library that exposes a global object, you should follow similar steps as with commojs modules with the exception that you should omit the `:module-type` attribute. | ||
Для використання бібіліотек, які використовують глобальні обʼєкти, слід створити конфігурацію, схожу на ту, що використовується для модулів CommonJS, але в описі модуля не треба вказувати поле `:module-type`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
з комою, бо відокремлюване означення
issue #27