在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Locale/localeapp开源软件地址(OpenSource Url):https://github.com/Locale/localeapp开源编程语言(OpenSource Language):Ruby 92.1%开源软件介绍(OpenSource Introduction):LocaleThe The gem hooks into the i18n exception mechanism to send missing translations to the app. When translated content has been added it's automatically pulled down so you can see it straight away. SecurityThough the i18n gem uses YAML as it's default file format it doesn't require serialization of ruby objects. To prevent the kind of security problems detailed in CVE-2013-0156 the localeapp gem will not load any YAML containing the string !ruby/ as of version 0.6.9. InstallationNote that the API key is actually never written to configuration files
generated by the gem, but is expected to be set in the environment as
For convenience, the Rails 3+Add the localeapp gem to your
Create a project on Locale and get the api key. Then run:
This will check everything looks good and create Rails 2.3Rails 2.3 support has been discontinued after 1.0.2. Please use this version at your own risk if you really want to. Non rails projectsInstall the gem and run:
This will create a Public projectsInstall the gem and run:
This will create a skeleton project you can push to Importing existing contentYou can import via localeapp.com or with the command line tool. To import existing translations do:
This will queue importing the file. The projects pages on localeapp.com will automatically refresh so you can see the import progress. If you've more than one locale to import you can import all files in a directory:
Default Rails TranslationsLocale will automatically add the standard rails translations when a project is created. If for some reason you don't want these, you can remove them using in the project libraries area on localeapp.com Automatically sending missing translationsMissing translations are automatically sent only in the development environment by default. When a page is refreshed any missing translations will be sent to localeapp.com. If you want to disable sending missing translations in the development environment then edit
This is just an array, so you can configure it to match send in any environment you wish. Manually create translationsYou can create translations on the command line by running:
You must provide at least one translation and the locale code must already exist in the project. Copy a translationYou can copy a translation on the command line by running:
If the destination key name exists in the project the content is overwritten, otherwise a new key is created. Automatically pulling translationsThere are two ways to do this, one that suits a single developer working the code locally and one where the translations are being pulled down to a staging (or live) server. Single developerIn this mode the gem pulls any updated translations from localeapp.com at the beginning of each request. This is the default setting so you don't need to do anything special. Staging serverIn this mode you configure the individual listeners to not poll every request and instead run localeapp in daemon mode to fetch updated translations. This is useful when you have more than one listener and don't want them to race to update the translations. Disabling pollingEdit config/initializers/localeapp.rb to include:
Run the daemon with:
The listeners will automatically reload translations when they see there are new ones. The daemon has two options: -b will run in the background and put a pid file in tmp/pids/localeapp.pid -i X will change the polling interval to X from it's default five seconds. Disabling ReloadingAutomatic reloading is only enabled in the development environment by default and can be disabled in a similar way to polling and sending:
Blacklisting keys and namespaces (Rails only)To prevent certain missing translations from being sent to the Locale servers - in case of automatically generated keys from a gem for example - you can configure the For example, to prevent all keys containing the word "simple_form" :
CachingTo prevent localeapp from sending translations every time they are missing, add this config setting:
Inviting other developers and translatorsYou can invite other developers and translators via localeapp.com. Developers have access to all the content and all the locales. Translators are restricted to editing only the locales you give them access too. Adding a localeIf we find an unknown locale during an import we'll add it to your project. You can also add a new locale to a project via localeapp.com. This will create missing translations for every translation key. You will need to restart any listeners completely to pick up the new locale. ProxiesIf you need to go through a proxy server, you can configure it with:
SSL Certificate verificationlocaleapp.com uses https everywhere but certificate validation is turned off by default. This is because ruby doesn't know how to read the certs from the OSX keychain. You can turn verification on and tell the gem where the latest CA certificates are by adding:
See this article on Ruby Inside for some more details. Support and feedbackYou can contact us via the support link at the bottom of the page or emailing [email protected] ContributingSee corresponding contributing guidelines. Known bugsWe are aware about a compatibility issue with JRuby 9.1 and i18n 1.3. Our recommandation so far is to use i18n < 1.3 if you are using JRuby 9.1. LicenseCopyright (c) 2014 Locale and other contributors, released under the MIT License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论