phrase 0.4.31 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +6 -0
- data/LICENSE +17 -18
- data/README.md +449 -280
- data/Rakefile +7 -4
- data/docs/Account.md +27 -0
- data/docs/AccountDetails.md +27 -0
- data/docs/AccountDetails1.md +17 -0
- data/docs/AccountsApi.md +134 -0
- data/docs/AffectedCount.md +17 -0
- data/docs/AffectedResources.md +17 -0
- data/docs/Authorization.md +31 -0
- data/docs/AuthorizationCreateParameters.md +21 -0
- data/docs/AuthorizationUpdateParameters.md +21 -0
- data/docs/AuthorizationWithToken.md +33 -0
- data/docs/AuthorizationWithToken1.md +17 -0
- data/docs/AuthorizationsApi.md +321 -0
- data/docs/BitbucketSync.md +27 -0
- data/docs/BitbucketSyncApi.md +197 -0
- data/docs/BitbucketSyncExportParameters.md +17 -0
- data/docs/BitbucketSyncExportResponse.md +17 -0
- data/docs/BitbucketSyncImportParameters.md +17 -0
- data/docs/BlacklistedKey.md +23 -0
- data/docs/BlacklistedKeyCreateParameters.md +17 -0
- data/docs/BlacklistedKeyUpdateParameters.md +17 -0
- data/docs/BlacklistedKeysApi.md +333 -0
- data/docs/Branch.md +29 -0
- data/docs/BranchCreateParameters.md +17 -0
- data/docs/BranchMergeParameters.md +17 -0
- data/docs/BranchUpdateParameters.md +17 -0
- data/docs/BranchesApi.md +459 -0
- data/docs/Comment.md +25 -0
- data/docs/CommentCreateParameters.md +19 -0
- data/docs/CommentMarkReadParameters.md +17 -0
- data/docs/CommentUpdateParameters.md +19 -0
- data/docs/CommentsApi.md +548 -0
- data/docs/Distribution.md +29 -0
- data/docs/DistributionCreateParameters.md +29 -0
- data/docs/DistributionPreview.md +29 -0
- data/docs/DistributionUpdateParameters.md +29 -0
- data/docs/DistributionsApi.md +331 -0
- data/docs/Document.md +23 -0
- data/docs/DocumentsApi.md +137 -0
- data/docs/Format.md +35 -0
- data/docs/FormatsApi.md +68 -0
- data/docs/GitHubSyncApi.md +130 -0
- data/docs/GitLabSyncApi.md +463 -0
- data/docs/GithubSyncExportParameters.md +17 -0
- data/docs/GithubSyncImportParameters.md +17 -0
- data/docs/GitlabSync.md +37 -0
- data/docs/GitlabSyncExport.md +19 -0
- data/docs/GitlabSyncExportParameters.md +17 -0
- data/docs/GitlabSyncHistory.md +25 -0
- data/docs/GitlabSyncImportParameters.md +17 -0
- data/docs/GlossariesApi.md +331 -0
- data/docs/Glossary.md +25 -0
- data/docs/GlossaryCreateParameters.md +21 -0
- data/docs/GlossaryTerm.md +31 -0
- data/docs/GlossaryTermCreateParameters.md +23 -0
- data/docs/GlossaryTermTranslation.md +25 -0
- data/docs/GlossaryTermTranslationCreateParameters.md +19 -0
- data/docs/GlossaryTermTranslationUpdateParameters.md +19 -0
- data/docs/GlossaryTermTranslationsApi.md +213 -0
- data/docs/GlossaryTermUpdateParameters.md +23 -0
- data/docs/GlossaryTermsApi.md +341 -0
- data/docs/GlossaryUpdateParameters.md +21 -0
- data/docs/InlineResponse422.md +19 -0
- data/docs/InlineResponse422Errors.md +21 -0
- data/docs/Invitation.md +35 -0
- data/docs/InvitationCreateParameters.md +25 -0
- data/docs/InvitationUpdateParameters.md +23 -0
- data/docs/InvitationsApi.md +395 -0
- data/docs/Job.md +29 -0
- data/docs/JobCompleteParameters.md +17 -0
- data/docs/JobCreateParameters.md +27 -0
- data/docs/JobDetails.md +37 -0
- data/docs/JobDetails1.md +23 -0
- data/docs/JobKeysCreateParameters.md +19 -0
- data/docs/JobLocale.md +23 -0
- data/docs/JobLocaleCompleteParameters.md +17 -0
- data/docs/JobLocaleReopenParameters.md +17 -0
- data/docs/JobLocaleUpdateParameters.md +21 -0
- data/docs/JobLocalesApi.md +483 -0
- data/docs/JobLocalesCreateParameters.md +21 -0
- data/docs/JobPreview.md +21 -0
- data/docs/JobReopenParameters.md +17 -0
- data/docs/JobStartParameters.md +17 -0
- data/docs/JobUpdateParameters.md +23 -0
- data/docs/JobsApi.md +674 -0
- data/docs/KeyCreateParameters.md +45 -0
- data/docs/KeyPreview.md +21 -0
- data/docs/KeyUpdateParameters.md +45 -0
- data/docs/KeysApi.md +609 -0
- data/docs/KeysSearchParameters.md +25 -0
- data/docs/KeysTagParameters.md +23 -0
- data/docs/KeysUntagParameters.md +23 -0
- data/docs/Locale.md +35 -0
- data/docs/LocaleCreateParameters.md +35 -0
- data/docs/LocaleDetails.md +37 -0
- data/docs/LocaleDetails1.md +17 -0
- data/docs/LocalePreview.md +21 -0
- data/docs/LocaleStatistics.md +29 -0
- data/docs/LocaleUpdateParameters.md +35 -0
- data/docs/LocalesApi.md +428 -0
- data/docs/Member.md +25 -0
- data/docs/MemberUpdateParameters.md +23 -0
- data/docs/MembersApi.md +267 -0
- data/docs/OrderConfirmParameters.md +17 -0
- data/docs/OrderCreateParameters.md +43 -0
- data/docs/OrdersApi.md +337 -0
- data/docs/Project.md +31 -0
- data/docs/ProjectCreateParameters.md +29 -0
- data/docs/ProjectDetails.md +33 -0
- data/docs/ProjectDetails1.md +19 -0
- data/docs/ProjectLocales.md +27 -0
- data/docs/ProjectLocales1.md +17 -0
- data/docs/ProjectShort.md +25 -0
- data/docs/ProjectUpdateParameters.md +27 -0
- data/docs/ProjectsApi.md +321 -0
- data/docs/Release.md +37 -0
- data/docs/ReleaseCreateParameters.md +21 -0
- data/docs/ReleasePreview.md +37 -0
- data/docs/ReleaseUpdateParameters.md +21 -0
- data/docs/ReleasesApi.md +407 -0
- data/docs/Screenshot.md +29 -0
- data/docs/ScreenshotCreateParameters.md +21 -0
- data/docs/ScreenshotMarker.md +27 -0
- data/docs/ScreenshotMarkerCreateParameters.md +19 -0
- data/docs/ScreenshotMarkerUpdateParameters.md +19 -0
- data/docs/ScreenshotMarkersApi.md +337 -0
- data/docs/ScreenshotUpdateParameters.md +21 -0
- data/docs/ScreenshotsApi.md +331 -0
- data/docs/Space.md +27 -0
- data/docs/SpaceCreateParameters.md +17 -0
- data/docs/SpaceUpdateParameters.md +17 -0
- data/docs/SpacesApi.md +529 -0
- data/docs/SpacesProjectsCreateParameters.md +17 -0
- data/docs/StyleGuidesApi.md +331 -0
- data/docs/Styleguide.md +23 -0
- data/docs/StyleguideCreateParameters.md +41 -0
- data/docs/StyleguideDetails.md +49 -0
- data/docs/StyleguideDetails1.md +41 -0
- data/docs/StyleguidePreview.md +19 -0
- data/docs/StyleguideUpdateParameters.md +41 -0
- data/docs/Tag.md +23 -0
- data/docs/TagCreateParameters.md +19 -0
- data/docs/TagWithStats.md +25 -0
- data/docs/TagWithStats1.md +17 -0
- data/docs/TagWithStats1Statistics.md +23 -0
- data/docs/TagWithStats1Statistics1.md +19 -0
- data/docs/TagsApi.md +271 -0
- data/docs/Team.md +29 -0
- data/docs/TeamCreateParameters.md +17 -0
- data/docs/TeamDetail.md +29 -0
- data/docs/TeamUpdateParameters.md +17 -0
- data/docs/TeamsApi.md +721 -0
- data/docs/TeamsProjectsCreateParameters.md +17 -0
- data/docs/TeamsSpacesCreateParameters.md +17 -0
- data/docs/TeamsUsersCreateParameters.md +17 -0
- data/docs/Translation.md +37 -0
- data/docs/TranslationCreateParameters.md +31 -0
- data/docs/TranslationDetails.md +41 -0
- data/docs/TranslationDetails1.md +19 -0
- data/docs/TranslationExcludeParameters.md +17 -0
- data/docs/TranslationIncludeParameters.md +17 -0
- data/docs/TranslationKey.md +33 -0
- data/docs/TranslationKeyDetails.md +51 -0
- data/docs/TranslationKeyDetails1.md +33 -0
- data/docs/TranslationOrder.md +49 -0
- data/docs/TranslationReviewParameters.md +17 -0
- data/docs/TranslationUnverifyParameters.md +17 -0
- data/docs/TranslationUpdateParameters.md +27 -0
- data/docs/TranslationVerifyParameters.md +17 -0
- data/docs/TranslationVersion.md +31 -0
- data/docs/TranslationVersionWithUser.md +33 -0
- data/docs/TranslationVersionWithUser1.md +17 -0
- data/docs/TranslationsApi.md +1148 -0
- data/docs/TranslationsExcludeParameters.md +23 -0
- data/docs/TranslationsIncludeParameters.md +23 -0
- data/docs/TranslationsReviewParameters.md +19 -0
- data/docs/TranslationsSearchParameters.md +23 -0
- data/docs/TranslationsUnverifyParameters.md +23 -0
- data/docs/TranslationsVerifyParameters.md +23 -0
- data/docs/Upload.md +31 -0
- data/docs/UploadCreateParameters.md +45 -0
- data/docs/UploadSummary.md +31 -0
- data/docs/UploadsApi.md +234 -0
- data/docs/User.md +29 -0
- data/docs/UserPreview.md +21 -0
- data/docs/UsersApi.md +68 -0
- data/docs/VersionsHistoryApi.md +146 -0
- data/docs/Webhook.md +29 -0
- data/docs/WebhookCreateParameters.md +23 -0
- data/docs/WebhookUpdateParameters.md +23 -0
- data/docs/WebhooksApi.md +394 -0
- data/git_push.sh +58 -0
- data/lib/phrase.rb +212 -55
- data/lib/phrase/api/accounts_api.rb +142 -0
- data/lib/phrase/api/authorizations_api.rb +348 -0
- data/lib/phrase/api/bitbucket_sync_api.rb +219 -0
- data/lib/phrase/api/blacklisted_keys_api.rb +381 -0
- data/lib/phrase/api/branches_api.rb +526 -0
- data/lib/phrase/api/comments_api.rb +659 -0
- data/lib/phrase/api/distributions_api.rb +378 -0
- data/lib/phrase/api/documents_api.rb +152 -0
- data/lib/phrase/api/formats_api.rb +70 -0
- data/lib/phrase/api/git_hub_sync_api.rb +146 -0
- data/lib/phrase/api/git_lab_sync_api.rb +510 -0
- data/lib/phrase/api/glossaries_api.rb +378 -0
- data/lib/phrase/api/glossary_term_translations_api.rb +270 -0
- data/lib/phrase/api/glossary_terms_api.rb +408 -0
- data/lib/phrase/api/invitations_api.rb +450 -0
- data/lib/phrase/api/job_locales_api.rb +589 -0
- data/lib/phrase/api/jobs_api.rb +792 -0
- data/lib/phrase/api/keys_api.rb +702 -0
- data/lib/phrase/api/locales_api.rb +499 -0
- data/lib/phrase/api/members_api.rb +304 -0
- data/lib/phrase/api/orders_api.rb +387 -0
- data/lib/phrase/api/projects_api.rb +348 -0
- data/lib/phrase/api/releases_api.rb +486 -0
- data/lib/phrase/api/screenshot_markers_api.rb +396 -0
- data/lib/phrase/api/screenshots_api.rb +378 -0
- data/lib/phrase/api/spaces_api.rb +610 -0
- data/lib/phrase/api/style_guides_api.rb +378 -0
- data/lib/phrase/api/tags_api.rb +307 -0
- data/lib/phrase/api/teams_api.rb +840 -0
- data/lib/phrase/api/translations_api.rb +1353 -0
- data/lib/phrase/api/uploads_api.rb +273 -0
- data/lib/phrase/api/users_api.rb +70 -0
- data/lib/phrase/api/versions_history_api.rb +172 -0
- data/lib/phrase/api/webhooks_api.rb +448 -0
- data/lib/phrase/api_client.rb +376 -0
- data/lib/phrase/api_error.rb +45 -0
- data/lib/phrase/configuration.rb +243 -0
- data/lib/phrase/models/account.rb +239 -0
- data/lib/phrase/models/account_details.rb +247 -0
- data/lib/phrase/models/account_details1.rb +194 -0
- data/lib/phrase/models/affected_count.rb +194 -0
- data/lib/phrase/models/affected_resources.rb +194 -0
- data/lib/phrase/models/authorization.rb +259 -0
- data/lib/phrase/models/authorization_create_parameters.rb +217 -0
- data/lib/phrase/models/authorization_update_parameters.rb +217 -0
- data/lib/phrase/models/authorization_with_token.rb +276 -0
- data/lib/phrase/models/authorization_with_token1.rb +194 -0
- data/lib/phrase/models/bitbucket_sync.rb +241 -0
- data/lib/phrase/models/bitbucket_sync_export_parameters.rb +195 -0
- data/lib/phrase/models/bitbucket_sync_export_response.rb +194 -0
- data/lib/phrase/models/bitbucket_sync_import_parameters.rb +195 -0
- data/lib/phrase/models/blacklisted_key.rb +221 -0
- data/lib/phrase/models/blacklisted_key_create_parameters.rb +195 -0
- data/lib/phrase/models/blacklisted_key_update_parameters.rb +195 -0
- data/lib/phrase/models/branch.rb +248 -0
- data/lib/phrase/models/branch_create_parameters.rb +195 -0
- data/lib/phrase/models/branch_merge_parameters.rb +195 -0
- data/lib/phrase/models/branch_update_parameters.rb +195 -0
- data/lib/phrase/models/comment.rb +230 -0
- data/lib/phrase/models/comment_create_parameters.rb +205 -0
- data/lib/phrase/models/comment_mark_read_parameters.rb +195 -0
- data/lib/phrase/models/comment_update_parameters.rb +205 -0
- data/lib/phrase/models/distribution.rb +252 -0
- data/lib/phrase/models/distribution_create_parameters.rb +259 -0
- data/lib/phrase/models/distribution_preview.rb +250 -0
- data/lib/phrase/models/distribution_update_parameters.rb +259 -0
- data/lib/phrase/models/document.rb +221 -0
- data/lib/phrase/models/format.rb +275 -0
- data/lib/phrase/models/github_sync_export_parameters.rb +195 -0
- data/lib/phrase/models/github_sync_import_parameters.rb +195 -0
- data/lib/phrase/models/gitlab_sync.rb +284 -0
- data/lib/phrase/models/gitlab_sync_export.rb +203 -0
- data/lib/phrase/models/gitlab_sync_export_parameters.rb +195 -0
- data/lib/phrase/models/gitlab_sync_history.rb +232 -0
- data/lib/phrase/models/gitlab_sync_import_parameters.rb +195 -0
- data/lib/phrase/models/glossary.rb +232 -0
- data/lib/phrase/models/glossary_create_parameters.rb +217 -0
- data/lib/phrase/models/glossary_term.rb +259 -0
- data/lib/phrase/models/glossary_term_create_parameters.rb +225 -0
- data/lib/phrase/models/glossary_term_translation.rb +230 -0
- data/lib/phrase/models/glossary_term_translation_create_parameters.rb +205 -0
- data/lib/phrase/models/glossary_term_translation_update_parameters.rb +205 -0
- data/lib/phrase/models/glossary_term_update_parameters.rb +225 -0
- data/lib/phrase/models/glossary_update_parameters.rb +217 -0
- data/lib/phrase/models/inline_response422.rb +205 -0
- data/lib/phrase/models/inline_response422_errors.rb +212 -0
- data/lib/phrase/models/invitation.rb +279 -0
- data/lib/phrase/models/invitation_create_parameters.rb +237 -0
- data/lib/phrase/models/invitation_update_parameters.rb +227 -0
- data/lib/phrase/models/job.rb +248 -0
- data/lib/phrase/models/job_complete_parameters.rb +195 -0
- data/lib/phrase/models/job_create_parameters.rb +249 -0
- data/lib/phrase/models/job_details.rb +296 -0
- data/lib/phrase/models/job_details1.rb +225 -0
- data/lib/phrase/models/job_keys_create_parameters.rb +207 -0
- data/lib/phrase/models/job_locale.rb +223 -0
- data/lib/phrase/models/job_locale_complete_parameters.rb +195 -0
- data/lib/phrase/models/job_locale_reopen_parameters.rb +195 -0
- data/lib/phrase/models/job_locale_update_parameters.rb +217 -0
- data/lib/phrase/models/job_locales_create_parameters.rb +217 -0
- data/lib/phrase/models/job_preview.rb +212 -0
- data/lib/phrase/models/job_reopen_parameters.rb +195 -0
- data/lib/phrase/models/job_start_parameters.rb +195 -0
- data/lib/phrase/models/job_update_parameters.rb +225 -0
- data/lib/phrase/models/key_create_parameters.rb +335 -0
- data/lib/phrase/models/key_preview.rb +212 -0
- data/lib/phrase/models/key_update_parameters.rb +335 -0
- data/lib/phrase/models/keys_search_parameters.rb +235 -0
- data/lib/phrase/models/keys_tag_parameters.rb +225 -0
- data/lib/phrase/models/keys_untag_parameters.rb +225 -0
- data/lib/phrase/models/locale.rb +277 -0
- data/lib/phrase/models/locale_create_parameters.rb +285 -0
- data/lib/phrase/models/locale_details.rb +294 -0
- data/lib/phrase/models/locale_details1.rb +194 -0
- data/lib/phrase/models/locale_preview.rb +212 -0
- data/lib/phrase/models/locale_statistics.rb +248 -0
- data/lib/phrase/models/locale_update_parameters.rb +285 -0
- data/lib/phrase/models/member.rb +232 -0
- data/lib/phrase/models/member_update_parameters.rb +227 -0
- data/lib/phrase/models/order_confirm_parameters.rb +195 -0
- data/lib/phrase/models/order_create_parameters.rb +327 -0
- data/lib/phrase/models/project.rb +257 -0
- data/lib/phrase/models/project_create_parameters.rb +255 -0
- data/lib/phrase/models/project_details.rb +274 -0
- data/lib/phrase/models/project_details1.rb +203 -0
- data/lib/phrase/models/project_locales.rb +249 -0
- data/lib/phrase/models/project_locales1.rb +196 -0
- data/lib/phrase/models/project_short.rb +230 -0
- data/lib/phrase/models/project_update_parameters.rb +245 -0
- data/lib/phrase/models/release.rb +290 -0
- data/lib/phrase/models/release_create_parameters.rb +217 -0
- data/lib/phrase/models/release_preview.rb +290 -0
- data/lib/phrase/models/release_update_parameters.rb +217 -0
- data/lib/phrase/models/screenshot.rb +248 -0
- data/lib/phrase/models/screenshot_create_parameters.rb +215 -0
- data/lib/phrase/models/screenshot_marker.rb +239 -0
- data/lib/phrase/models/screenshot_marker_create_parameters.rb +205 -0
- data/lib/phrase/models/screenshot_marker_update_parameters.rb +205 -0
- data/lib/phrase/models/screenshot_update_parameters.rb +215 -0
- data/lib/phrase/models/space.rb +241 -0
- data/lib/phrase/models/space_create_parameters.rb +195 -0
- data/lib/phrase/models/space_update_parameters.rb +195 -0
- data/lib/phrase/models/spaces_projects_create_parameters.rb +195 -0
- data/lib/phrase/models/styleguide.rb +221 -0
- data/lib/phrase/models/styleguide_create_parameters.rb +315 -0
- data/lib/phrase/models/styleguide_details.rb +346 -0
- data/lib/phrase/models/styleguide_details1.rb +302 -0
- data/lib/phrase/models/styleguide_preview.rb +203 -0
- data/lib/phrase/models/styleguide_update_parameters.rb +315 -0
- data/lib/phrase/models/tag.rb +221 -0
- data/lib/phrase/models/tag_create_parameters.rb +205 -0
- data/lib/phrase/models/tag_with_stats.rb +240 -0
- data/lib/phrase/models/tag_with_stats1.rb +196 -0
- data/lib/phrase/models/tag_with_stats1_statistics.rb +221 -0
- data/lib/phrase/models/tag_with_stats1_statistics1.rb +203 -0
- data/lib/phrase/models/team.rb +254 -0
- data/lib/phrase/models/team_create_parameters.rb +195 -0
- data/lib/phrase/models/team_detail.rb +254 -0
- data/lib/phrase/models/team_update_parameters.rb +195 -0
- data/lib/phrase/models/teams_projects_create_parameters.rb +195 -0
- data/lib/phrase/models/teams_spaces_create_parameters.rb +195 -0
- data/lib/phrase/models/teams_users_create_parameters.rb +195 -0
- data/lib/phrase/models/translation.rb +286 -0
- data/lib/phrase/models/translation_create_parameters.rb +265 -0
- data/lib/phrase/models/translation_details.rb +312 -0
- data/lib/phrase/models/translation_details1.rb +203 -0
- data/lib/phrase/models/translation_exclude_parameters.rb +195 -0
- data/lib/phrase/models/translation_include_parameters.rb +195 -0
- data/lib/phrase/models/translation_key.rb +268 -0
- data/lib/phrase/models/translation_key_details.rb +357 -0
- data/lib/phrase/models/translation_key_details1.rb +266 -0
- data/lib/phrase/models/translation_order.rb +340 -0
- data/lib/phrase/models/translation_review_parameters.rb +195 -0
- data/lib/phrase/models/translation_unverify_parameters.rb +195 -0
- data/lib/phrase/models/translation_update_parameters.rb +245 -0
- data/lib/phrase/models/translation_verify_parameters.rb +195 -0
- data/lib/phrase/models/translation_version.rb +257 -0
- data/lib/phrase/models/translation_version_with_user.rb +274 -0
- data/lib/phrase/models/translation_version_with_user1.rb +194 -0
- data/lib/phrase/models/translations_exclude_parameters.rb +225 -0
- data/lib/phrase/models/translations_include_parameters.rb +225 -0
- data/lib/phrase/models/translations_review_parameters.rb +205 -0
- data/lib/phrase/models/translations_search_parameters.rb +225 -0
- data/lib/phrase/models/translations_unverify_parameters.rb +225 -0
- data/lib/phrase/models/translations_verify_parameters.rb +225 -0
- data/lib/phrase/models/upload.rb +257 -0
- data/lib/phrase/models/upload_create_parameters.rb +335 -0
- data/lib/phrase/models/upload_summary.rb +257 -0
- data/lib/phrase/models/user.rb +248 -0
- data/lib/phrase/models/user_preview.rb +212 -0
- data/lib/phrase/models/webhook.rb +250 -0
- data/lib/phrase/models/webhook_create_parameters.rb +225 -0
- data/lib/phrase/models/webhook_update_parameters.rb +225 -0
- data/lib/phrase/response.rb +41 -0
- data/lib/phrase/version.rb +1 -1
- data/phrase.gemspec +27 -27
- data/spec/api/accounts_api_spec.rb +50 -0
- data/spec/api/authorizations_api_spec.rb +90 -0
- data/spec/api/bitbucket_sync_api_spec.rb +64 -0
- data/spec/api/blacklisted_keys_api_spec.rb +96 -0
- data/spec/api/branches_api_spec.rb +124 -0
- data/spec/api/comments_api_spec.rb +151 -0
- data/spec/api/distributions_api_spec.rb +95 -0
- data/spec/api/documents_api_spec.rb +52 -0
- data/spec/api/formats_api_spec.rb +35 -0
- data/spec/api/git_hub_sync_api_spec.rb +49 -0
- data/spec/api/git_lab_sync_api_spec.rb +125 -0
- data/spec/api/glossaries_api_spec.rb +95 -0
- data/spec/api/glossary_term_translations_api_spec.rb +72 -0
- data/spec/api/glossary_terms_api_spec.rb +100 -0
- data/spec/api/invitations_api_spec.rb +109 -0
- data/spec/api/job_locales_api_spec.rb +135 -0
- data/spec/api/jobs_api_spec.rb +177 -0
- data/spec/api/keys_api_spec.rb +162 -0
- data/spec/api/locales_api_spec.rb +126 -0
- data/spec/api/members_api_spec.rb +81 -0
- data/spec/api/orders_api_spec.rb +98 -0
- data/spec/api/projects_api_spec.rb +90 -0
- data/spec/api/releases_api_spec.rb +115 -0
- data/spec/api/screenshot_markers_api_spec.rb +98 -0
- data/spec/api/screenshots_api_spec.rb +95 -0
- data/spec/api/spaces_api_spec.rb +141 -0
- data/spec/api/style_guides_api_spec.rb +95 -0
- data/spec/api/tags_api_spec.rb +83 -0
- data/spec/api/teams_api_spec.rb +185 -0
- data/spec/api/translations_api_spec.rb +287 -0
- data/spec/api/uploads_api_spec.rb +82 -0
- data/spec/api/users_api_spec.rb +35 -0
- data/spec/api/versions_history_api_spec.rb +56 -0
- data/spec/api/webhooks_api_spec.rb +109 -0
- data/spec/api_client_spec.rb +214 -0
- data/spec/configuration_spec.rb +30 -0
- data/spec/models/account_details1_spec.rb +29 -0
- data/spec/models/account_details_spec.rb +59 -0
- data/spec/models/account_spec.rb +59 -0
- data/spec/models/affected_count_spec.rb +29 -0
- data/spec/models/affected_resources_spec.rb +29 -0
- data/spec/models/authorization_create_parameters_spec.rb +41 -0
- data/spec/models/authorization_spec.rb +71 -0
- data/spec/models/authorization_update_parameters_spec.rb +41 -0
- data/spec/models/authorization_with_token1_spec.rb +29 -0
- data/spec/models/authorization_with_token_spec.rb +77 -0
- data/spec/models/bitbucket_sync_export_parameters_spec.rb +29 -0
- data/spec/models/bitbucket_sync_export_response_spec.rb +29 -0
- data/spec/models/bitbucket_sync_import_parameters_spec.rb +29 -0
- data/spec/models/bitbucket_sync_spec.rb +59 -0
- data/spec/models/blacklisted_key_create_parameters_spec.rb +29 -0
- data/spec/models/blacklisted_key_spec.rb +47 -0
- data/spec/models/blacklisted_key_update_parameters_spec.rb +29 -0
- data/spec/models/branch_create_parameters_spec.rb +29 -0
- data/spec/models/branch_merge_parameters_spec.rb +29 -0
- data/spec/models/branch_spec.rb +65 -0
- data/spec/models/branch_update_parameters_spec.rb +29 -0
- data/spec/models/comment_create_parameters_spec.rb +35 -0
- data/spec/models/comment_mark_read_parameters_spec.rb +29 -0
- data/spec/models/comment_spec.rb +53 -0
- data/spec/models/comment_update_parameters_spec.rb +35 -0
- data/spec/models/distribution_create_parameters_spec.rb +65 -0
- data/spec/models/distribution_preview_spec.rb +65 -0
- data/spec/models/distribution_spec.rb +65 -0
- data/spec/models/distribution_update_parameters_spec.rb +65 -0
- data/spec/models/document_spec.rb +47 -0
- data/spec/models/format_spec.rb +83 -0
- data/spec/models/github_sync_export_parameters_spec.rb +29 -0
- data/spec/models/github_sync_import_parameters_spec.rb +29 -0
- data/spec/models/gitlab_sync_export_parameters_spec.rb +29 -0
- data/spec/models/gitlab_sync_export_spec.rb +35 -0
- data/spec/models/gitlab_sync_history_spec.rb +53 -0
- data/spec/models/gitlab_sync_import_parameters_spec.rb +29 -0
- data/spec/models/gitlab_sync_spec.rb +89 -0
- data/spec/models/glossary_create_parameters_spec.rb +41 -0
- data/spec/models/glossary_spec.rb +53 -0
- data/spec/models/glossary_term_create_parameters_spec.rb +47 -0
- data/spec/models/glossary_term_spec.rb +71 -0
- data/spec/models/glossary_term_translation_create_parameters_spec.rb +35 -0
- data/spec/models/glossary_term_translation_spec.rb +53 -0
- data/spec/models/glossary_term_translation_update_parameters_spec.rb +35 -0
- data/spec/models/glossary_term_update_parameters_spec.rb +47 -0
- data/spec/models/glossary_update_parameters_spec.rb +41 -0
- data/spec/models/inline_response422_errors_spec.rb +41 -0
- data/spec/models/inline_response422_spec.rb +35 -0
- data/spec/models/invitation_create_parameters_spec.rb +53 -0
- data/spec/models/invitation_spec.rb +83 -0
- data/spec/models/invitation_update_parameters_spec.rb +47 -0
- data/spec/models/job_complete_parameters_spec.rb +29 -0
- data/spec/models/job_create_parameters_spec.rb +59 -0
- data/spec/models/job_details1_spec.rb +47 -0
- data/spec/models/job_details_spec.rb +89 -0
- data/spec/models/job_keys_create_parameters_spec.rb +35 -0
- data/spec/models/job_locale_complete_parameters_spec.rb +29 -0
- data/spec/models/job_locale_reopen_parameters_spec.rb +29 -0
- data/spec/models/job_locale_spec.rb +47 -0
- data/spec/models/job_locale_update_parameters_spec.rb +41 -0
- data/spec/models/job_locales_create_parameters_spec.rb +41 -0
- data/spec/models/job_preview_spec.rb +41 -0
- data/spec/models/job_reopen_parameters_spec.rb +29 -0
- data/spec/models/job_spec.rb +65 -0
- data/spec/models/job_start_parameters_spec.rb +29 -0
- data/spec/models/job_update_parameters_spec.rb +47 -0
- data/spec/models/key_create_parameters_spec.rb +113 -0
- data/spec/models/key_preview_spec.rb +41 -0
- data/spec/models/key_update_parameters_spec.rb +113 -0
- data/spec/models/keys_search_parameters_spec.rb +53 -0
- data/spec/models/keys_tag_parameters_spec.rb +47 -0
- data/spec/models/keys_untag_parameters_spec.rb +47 -0
- data/spec/models/locale_create_parameters_spec.rb +83 -0
- data/spec/models/locale_details1_spec.rb +29 -0
- data/spec/models/locale_details_spec.rb +89 -0
- data/spec/models/locale_preview_spec.rb +41 -0
- data/spec/models/locale_spec.rb +83 -0
- data/spec/models/locale_statistics_spec.rb +65 -0
- data/spec/models/locale_update_parameters_spec.rb +83 -0
- data/spec/models/member_spec.rb +53 -0
- data/spec/models/member_update_parameters_spec.rb +47 -0
- data/spec/models/order_confirm_parameters_spec.rb +29 -0
- data/spec/models/order_create_parameters_spec.rb +107 -0
- data/spec/models/project_create_parameters_spec.rb +65 -0
- data/spec/models/project_details1_spec.rb +35 -0
- data/spec/models/project_details_spec.rb +77 -0
- data/spec/models/project_locales1_spec.rb +29 -0
- data/spec/models/project_locales_spec.rb +59 -0
- data/spec/models/project_short_spec.rb +53 -0
- data/spec/models/project_spec.rb +71 -0
- data/spec/models/project_update_parameters_spec.rb +59 -0
- data/spec/models/release_create_parameters_spec.rb +41 -0
- data/spec/models/release_preview_spec.rb +89 -0
- data/spec/models/release_spec.rb +89 -0
- data/spec/models/release_update_parameters_spec.rb +41 -0
- data/spec/models/screenshot_create_parameters_spec.rb +41 -0
- data/spec/models/screenshot_marker_create_parameters_spec.rb +35 -0
- data/spec/models/screenshot_marker_spec.rb +59 -0
- data/spec/models/screenshot_marker_update_parameters_spec.rb +35 -0
- data/spec/models/screenshot_spec.rb +65 -0
- data/spec/models/screenshot_update_parameters_spec.rb +41 -0
- data/spec/models/space_create_parameters_spec.rb +29 -0
- data/spec/models/space_spec.rb +59 -0
- data/spec/models/space_update_parameters_spec.rb +29 -0
- data/spec/models/spaces_projects_create_parameters_spec.rb +29 -0
- data/spec/models/styleguide_create_parameters_spec.rb +101 -0
- data/spec/models/styleguide_details1_spec.rb +101 -0
- data/spec/models/styleguide_details_spec.rb +125 -0
- data/spec/models/styleguide_preview_spec.rb +35 -0
- data/spec/models/styleguide_spec.rb +47 -0
- data/spec/models/styleguide_update_parameters_spec.rb +101 -0
- data/spec/models/tag_create_parameters_spec.rb +35 -0
- data/spec/models/tag_spec.rb +47 -0
- data/spec/models/tag_with_stats1_spec.rb +29 -0
- data/spec/models/tag_with_stats1_statistics1_spec.rb +35 -0
- data/spec/models/tag_with_stats1_statistics_spec.rb +47 -0
- data/spec/models/tag_with_stats_spec.rb +53 -0
- data/spec/models/team_create_parameters_spec.rb +29 -0
- data/spec/models/team_detail_spec.rb +65 -0
- data/spec/models/team_spec.rb +65 -0
- data/spec/models/team_update_parameters_spec.rb +29 -0
- data/spec/models/teams_projects_create_parameters_spec.rb +29 -0
- data/spec/models/teams_spaces_create_parameters_spec.rb +29 -0
- data/spec/models/teams_users_create_parameters_spec.rb +29 -0
- data/spec/models/translation_create_parameters_spec.rb +71 -0
- data/spec/models/translation_details1_spec.rb +35 -0
- data/spec/models/translation_details_spec.rb +101 -0
- data/spec/models/translation_exclude_parameters_spec.rb +29 -0
- data/spec/models/translation_include_parameters_spec.rb +29 -0
- data/spec/models/translation_key_details1_spec.rb +77 -0
- data/spec/models/translation_key_details_spec.rb +131 -0
- data/spec/models/translation_key_spec.rb +77 -0
- data/spec/models/translation_order_spec.rb +125 -0
- data/spec/models/translation_review_parameters_spec.rb +29 -0
- data/spec/models/translation_spec.rb +89 -0
- data/spec/models/translation_unverify_parameters_spec.rb +29 -0
- data/spec/models/translation_update_parameters_spec.rb +59 -0
- data/spec/models/translation_verify_parameters_spec.rb +29 -0
- data/spec/models/translation_version_spec.rb +71 -0
- data/spec/models/translation_version_with_user1_spec.rb +29 -0
- data/spec/models/translation_version_with_user_spec.rb +77 -0
- data/spec/models/translations_exclude_parameters_spec.rb +47 -0
- data/spec/models/translations_include_parameters_spec.rb +47 -0
- data/spec/models/translations_review_parameters_spec.rb +35 -0
- data/spec/models/translations_search_parameters_spec.rb +47 -0
- data/spec/models/translations_unverify_parameters_spec.rb +47 -0
- data/spec/models/translations_verify_parameters_spec.rb +47 -0
- data/spec/models/upload_create_parameters_spec.rb +113 -0
- data/spec/models/upload_spec.rb +71 -0
- data/spec/models/upload_summary_spec.rb +71 -0
- data/spec/models/user_preview_spec.rb +41 -0
- data/spec/models/user_spec.rb +65 -0
- data/spec/models/webhook_create_parameters_spec.rb +47 -0
- data/spec/models/webhook_spec.rb +65 -0
- data/spec/models/webhook_update_parameters_spec.rb +47 -0
- data/spec/spec_helper.rb +99 -0
- metadata +819 -188
- data/.gitignore +0 -25
- data/.travis.yml +0 -4
- data/Guardfile +0 -29
- data/bin/phrase +0 -8
- data/cacert.pem +0 -3366
- data/lib/ext/all.rb +0 -5
- data/lib/ext/hash.rb +0 -8
- data/lib/ext/object.rb +0 -130
- data/lib/ext/try.rb +0 -57
- data/lib/generators/phrase/install_generator.rb +0 -37
- data/lib/generators/templates/README +0 -11
- data/lib/generators/templates/phrase.rb +0 -21
- data/lib/phrase/adapters/fast_gettext.rb +0 -25
- data/lib/phrase/adapters/i18n.rb +0 -12
- data/lib/phrase/api.rb +0 -7
- data/lib/phrase/api/client.rb +0 -308
- data/lib/phrase/api/client/http.rb +0 -56
- data/lib/phrase/api/config.rb +0 -34
- data/lib/phrase/api/exceptions.rb +0 -9
- data/lib/phrase/api/query_params.rb +0 -22
- data/lib/phrase/backend.rb +0 -7
- data/lib/phrase/backend/base.rb +0 -6
- data/lib/phrase/backend/phrase_service.rb +0 -163
- data/lib/phrase/cache.rb +0 -34
- data/lib/phrase/config.rb +0 -94
- data/lib/phrase/delegate.rb +0 -36
- data/lib/phrase/delegate/fast_gettext.rb +0 -27
- data/lib/phrase/delegate/i18n.rb +0 -166
- data/lib/phrase/engine.rb +0 -14
- data/lib/phrase/formats.rb +0 -172
- data/lib/phrase/formats/angular_translate.rb +0 -19
- data/lib/phrase/formats/csv.rb +0 -19
- data/lib/phrase/formats/custom.rb +0 -40
- data/lib/phrase/formats/gettext.rb +0 -27
- data/lib/phrase/formats/gettext_template.rb +0 -19
- data/lib/phrase/formats/ini.rb +0 -19
- data/lib/phrase/formats/json.rb +0 -19
- data/lib/phrase/formats/laravel.rb +0 -19
- data/lib/phrase/formats/mozilla_properties.rb +0 -8
- data/lib/phrase/formats/nested_json.rb +0 -19
- data/lib/phrase/formats/node_json.rb +0 -23
- data/lib/phrase/formats/php_array.rb +0 -19
- data/lib/phrase/formats/play_properties.rb +0 -15
- data/lib/phrase/formats/plist.rb +0 -19
- data/lib/phrase/formats/properties.rb +0 -19
- data/lib/phrase/formats/properties_xml.rb +0 -19
- data/lib/phrase/formats/qt_phrase_book.rb +0 -19
- data/lib/phrase/formats/qt_translation_source.rb +0 -19
- data/lib/phrase/formats/resx.rb +0 -19
- data/lib/phrase/formats/resx_windowsphone.rb +0 -19
- data/lib/phrase/formats/simple_json.rb +0 -19
- data/lib/phrase/formats/strings.rb +0 -45
- data/lib/phrase/formats/tmx.rb +0 -19
- data/lib/phrase/formats/windows8_resource.rb +0 -19
- data/lib/phrase/formats/xliff.rb +0 -19
- data/lib/phrase/formats/xml.rb +0 -49
- data/lib/phrase/formats/yaml.rb +0 -19
- data/lib/phrase/formats/yaml_symfony.rb +0 -19
- data/lib/phrase/formats/yaml_symfony2.rb +0 -8
- data/lib/phrase/hash_flattener.rb +0 -21
- data/lib/phrase/tool.rb +0 -46
- data/lib/phrase/tool/commands.rb +0 -56
- data/lib/phrase/tool/commands/base.rb +0 -73
- data/lib/phrase/tool/commands/init.rb +0 -51
- data/lib/phrase/tool/commands/pull.rb +0 -109
- data/lib/phrase/tool/commands/push.rb +0 -163
- data/lib/phrase/tool/commands/show_help.rb +0 -26
- data/lib/phrase/tool/commands/show_version.rb +0 -17
- data/lib/phrase/tool/commands/tags.rb +0 -29
- data/lib/phrase/tool/config.rb +0 -120
- data/lib/phrase/tool/encoding_detector.rb +0 -17
- data/lib/phrase/tool/locale.rb +0 -41
- data/lib/phrase/tool/options.rb +0 -32
- data/lib/phrase/tool/options_factory.rb +0 -150
- data/lib/phrase/tool/tag_validator.rb +0 -9
- data/lib/phrase/view_helpers.rb +0 -19
@@ -1,27 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'phrase/delegate'
|
4
|
-
|
5
|
-
class Phrase::Delegate::FastGettext < Phrase::Delegate::Base
|
6
|
-
def initialize(method, *args)
|
7
|
-
@method = method
|
8
|
-
params = params_from_args(args)
|
9
|
-
@display_key = params[:msgid]
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
def params_from_args(args)
|
14
|
-
params = case @method
|
15
|
-
when :_
|
16
|
-
{msgid: args.first}
|
17
|
-
when :n_
|
18
|
-
{msgid: args.first, msgid_plural: args[1], count: args.last}
|
19
|
-
when :s_
|
20
|
-
{msgid: args.first}
|
21
|
-
else
|
22
|
-
self.class.log("Unsupported FastGettext method #{@method}")
|
23
|
-
{}
|
24
|
-
end
|
25
|
-
params
|
26
|
-
end
|
27
|
-
end
|
data/lib/phrase/delegate/i18n.rb
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'phrase/api'
|
4
|
-
require 'phrase/cache'
|
5
|
-
require 'phrase/hash_flattener'
|
6
|
-
require 'phrase/delegate'
|
7
|
-
require 'set'
|
8
|
-
|
9
|
-
class Phrase::Delegate::I18n < Phrase::Delegate::Base
|
10
|
-
attr_accessor :key, :display_key, :options, :api_client, :fallback_keys, :original_args
|
11
|
-
|
12
|
-
def initialize(key, options={}, original_args=nil)
|
13
|
-
@display_key = @key = key
|
14
|
-
@options = options
|
15
|
-
@original_args = original_args
|
16
|
-
|
17
|
-
@fallback_keys = []
|
18
|
-
|
19
|
-
extract_fallback_keys
|
20
|
-
identify_key_to_display if @fallback_keys.any?
|
21
|
-
super(decorated_key_name)
|
22
|
-
end
|
23
|
-
|
24
|
-
def method_missing(*args, &block)
|
25
|
-
self.class.log "Trying to execute missing method ##{args.first} on key #{@key}"
|
26
|
-
|
27
|
-
if @key.respond_to?(args.first)
|
28
|
-
to_s.send(*args)
|
29
|
-
else
|
30
|
-
data = translation_or_subkeys
|
31
|
-
|
32
|
-
if data.respond_to?(args.first)
|
33
|
-
data.send(*args, &block)
|
34
|
-
else
|
35
|
-
self.class.log "You tried to execute the missing method ##{args.first} on key #{@key} which is not supported. Please make sure you treat your translations as strings only."
|
36
|
-
original_translation = I18n.translate_without_phrase(*@original_args)
|
37
|
-
original_translation.send(*args, &block)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
def identify_key_to_display
|
44
|
-
key_names = [@key] | @fallback_keys
|
45
|
-
available_key_names = find_keys_within_phrase(key_names)
|
46
|
-
@display_key = @key
|
47
|
-
key_names.each do |item|
|
48
|
-
if available_key_names.include?(item)
|
49
|
-
@display_key = item
|
50
|
-
break
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def find_keys_within_phrase(key_names)
|
56
|
-
key_names_to_check_against_api = key_names - pre_fetched(key_names)
|
57
|
-
pre_cached(key_names) | key_names_returned_from_api_for(key_names_to_check_against_api)
|
58
|
-
end
|
59
|
-
|
60
|
-
def pre_cached(key_names)
|
61
|
-
warm_translation_key_names_cache unless cache.cached?(:translation_key_names)
|
62
|
-
pre_cached_key_names = key_names.select { |key_name| key_name_precached?(key_name) }
|
63
|
-
pre_cached_key_names
|
64
|
-
end
|
65
|
-
|
66
|
-
def pre_fetched(key_names)
|
67
|
-
key_names.select { |key_name| covered_by_initial_caching?(key_name) }
|
68
|
-
end
|
69
|
-
|
70
|
-
def key_name_precached?(key_name)
|
71
|
-
covered = covered_by_initial_caching?(key_name)
|
72
|
-
in_cache = key_name_is_in_cache?(key_name)
|
73
|
-
covered && in_cache
|
74
|
-
end
|
75
|
-
|
76
|
-
def key_names_returned_from_api_for(key_names)
|
77
|
-
if key_names.size > 0
|
78
|
-
api_client.find_keys_by_name(key_names).map { |key| key["name"] }
|
79
|
-
else
|
80
|
-
[]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def key_name_is_in_cache?(key_name)
|
85
|
-
cache.get(:translation_key_names).include?(key_name)
|
86
|
-
end
|
87
|
-
|
88
|
-
def covered_by_initial_caching?(key_name)
|
89
|
-
key_name.start_with?(*Phrase.cache_key_segments_initial)
|
90
|
-
end
|
91
|
-
|
92
|
-
def extract_fallback_keys
|
93
|
-
fallback_items = []
|
94
|
-
if @options.has_key?(:default)
|
95
|
-
if @options[:default].kind_of?(Array)
|
96
|
-
fallback_items = @options[:default]
|
97
|
-
else
|
98
|
-
fallback_items << @options[:default]
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
fallback_items.each do |item|
|
103
|
-
process_fallback_item(item)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def scoped(item)
|
108
|
-
@options.has_key?(:scope) ? "#{@options[:scope]}.#{item}" : item
|
109
|
-
end
|
110
|
-
|
111
|
-
def process_fallback_item(item)
|
112
|
-
if item.kind_of?(Symbol)
|
113
|
-
entry = scoped(item.to_s)
|
114
|
-
@fallback_keys << entry
|
115
|
-
if @key == "helpers.label.#{entry}" # http://apidock.com/rails/v3.1.0/ActionView/Helpers/FormHelper/label
|
116
|
-
@fallback_keys << "activerecord.attributes.#{entry}"
|
117
|
-
end
|
118
|
-
|
119
|
-
if @key.start_with?("simple_form.") # special treatment for simple form
|
120
|
-
@fallback_keys << "activerecord.attributes.#{item.to_s}"
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def translation_or_subkeys
|
126
|
-
begin
|
127
|
-
api_client.translate(@key)
|
128
|
-
rescue Exception => e
|
129
|
-
self.class.log "Server Error: #{e.message}"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def api_client
|
134
|
-
@api_client ||= Phrase::Api::Client.new(Phrase.auth_token)
|
135
|
-
end
|
136
|
-
|
137
|
-
def cache
|
138
|
-
Thread.current[:phrase_cache] ||= build_cache
|
139
|
-
end
|
140
|
-
|
141
|
-
def build_cache
|
142
|
-
cache = Phrase::Cache.new
|
143
|
-
end
|
144
|
-
|
145
|
-
def warm_translation_key_names_cache
|
146
|
-
cache.set(:translation_key_names, prefetched_key_names)
|
147
|
-
end
|
148
|
-
|
149
|
-
def prefetched_key_names
|
150
|
-
prefetched = Set.new
|
151
|
-
Phrase.cache_key_segments_initial.each do |segment|
|
152
|
-
result = api_client.translate(segment)
|
153
|
-
prefetched.add(segment) if result.is_a?(String)
|
154
|
-
prefetched = prefetched.merge(key_names_from_nested(segment, result))
|
155
|
-
end
|
156
|
-
prefetched
|
157
|
-
end
|
158
|
-
|
159
|
-
def key_names_from_nested(segment, data)
|
160
|
-
key_names = Set.new
|
161
|
-
Phrase::HashFlattener.flatten(data, nil) do |key, value|
|
162
|
-
key_names.add("#{segment}.#{key}") unless value.is_a?(Hash)
|
163
|
-
end unless (data.is_a?(String) || data.nil?)
|
164
|
-
key_names
|
165
|
-
end
|
166
|
-
end
|
data/lib/phrase/engine.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'phrase'
|
4
|
-
require 'i18n'
|
5
|
-
|
6
|
-
if defined? Rails
|
7
|
-
class Phrase::Engine < Rails::Engine
|
8
|
-
initializer 'phrase', :after => :disable_dependency_loading do |app|
|
9
|
-
require 'phrase/adapters/i18n'
|
10
|
-
require 'phrase/adapters/fast_gettext'
|
11
|
-
ActionView::Base.send :include, Phrase::ViewHelpers
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/lib/phrase/formats.rb
DELETED
@@ -1,172 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
module Phrase
|
4
|
-
module Formats
|
5
|
-
autoload :Custom, 'phrase/formats/custom'
|
6
|
-
autoload :Json, 'phrase/formats/json'
|
7
|
-
autoload :Csv, 'phrase/formats/csv'
|
8
|
-
autoload :Gettext, 'phrase/formats/gettext'
|
9
|
-
autoload :GettextTemplate, 'phrase/formats/gettext_template'
|
10
|
-
autoload :Ini, 'phrase/formats/ini'
|
11
|
-
autoload :Properties, 'phrase/formats/properties'
|
12
|
-
autoload :PropertiesXml, 'phrase/formats/properties_xml'
|
13
|
-
autoload :Plist, 'phrase/formats/plist'
|
14
|
-
autoload :QtPhraseBook, 'phrase/formats/qt_phrase_book'
|
15
|
-
autoload :QtTranslationSource, 'phrase/formats/qt_translation_source'
|
16
|
-
autoload :Resx, 'phrase/formats/resx'
|
17
|
-
autoload :ResxWindowsphone, 'phrase/formats/resx_windowsphone'
|
18
|
-
autoload :Windows8Resource, 'phrase/formats/windows8_resource'
|
19
|
-
autoload :SimpleJson, 'phrase/formats/simple_json'
|
20
|
-
autoload :NestedJson, 'phrase/formats/nested_json'
|
21
|
-
autoload :NodeJson, 'phrase/formats/node_json'
|
22
|
-
autoload :Strings, 'phrase/formats/strings'
|
23
|
-
autoload :Xml, 'phrase/formats/xml'
|
24
|
-
autoload :Tmx, 'phrase/formats/tmx'
|
25
|
-
autoload :Xliff, 'phrase/formats/xliff'
|
26
|
-
autoload :Yaml, 'phrase/formats/yaml'
|
27
|
-
autoload :YamlSymfony, 'phrase/formats/yaml_symfony'
|
28
|
-
autoload :YamlSymfony2, 'phrase/formats/yaml_symfony2'
|
29
|
-
autoload :PhpArray, 'phrase/formats/php_array'
|
30
|
-
autoload :Laravel, 'phrase/formats/laravel'
|
31
|
-
autoload :AngularTranslate, 'phrase/formats/angular_translate'
|
32
|
-
autoload :MozillaProperties, 'phrase/formats/mozilla_properties'
|
33
|
-
autoload :PlayProperties, 'phrase/formats/play_properties'
|
34
|
-
|
35
|
-
class Base
|
36
|
-
def self.supports_extension?(extension)
|
37
|
-
self.extensions.map(&:to_s).include?(extension.to_s) or self.renders_locale_as_extension?
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.renders_locale_as_extension?
|
41
|
-
false
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.extensions
|
45
|
-
[]
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.directory_for_locale(locale)
|
49
|
-
"./"
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.filename_for_locale(locale)
|
53
|
-
raise "not implemented"
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.extract_locale_name_from_file_path(file_path)
|
57
|
-
nil
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.default_locale_name
|
61
|
-
Phrase::Tool::Locale.find_default_locale.try(:name)
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.locale_aware?
|
65
|
-
false
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.target_directory
|
69
|
-
"phrase/locales/"
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.config
|
73
|
-
Phrase::Tool.config
|
74
|
-
end
|
75
|
-
private_class_method :config
|
76
|
-
end
|
77
|
-
|
78
|
-
SUPPORTED_FORMATS = {
|
79
|
-
custom: Phrase::Formats::Custom,
|
80
|
-
json: Phrase::Formats::Json,
|
81
|
-
csv: Phrase::Formats::Csv,
|
82
|
-
gettext: Phrase::Formats::Gettext,
|
83
|
-
gettext_template: Phrase::Formats::GettextTemplate,
|
84
|
-
ini: Phrase::Formats::Ini,
|
85
|
-
properties: Phrase::Formats::Properties,
|
86
|
-
properties_xml: Phrase::Formats::PropertiesXml,
|
87
|
-
plist: Phrase::Formats::Plist,
|
88
|
-
qph: Phrase::Formats::QtPhraseBook,
|
89
|
-
ts: Phrase::Formats::QtTranslationSource,
|
90
|
-
resx: Phrase::Formats::Resx,
|
91
|
-
resx_windowsphone: Phrase::Formats::ResxWindowsphone,
|
92
|
-
windows8_resource: Phrase::Formats::Windows8Resource,
|
93
|
-
simple_json: Phrase::Formats::SimpleJson,
|
94
|
-
nested_json: Phrase::Formats::NestedJson,
|
95
|
-
node_json: Phrase::Formats::NodeJson,
|
96
|
-
strings: Phrase::Formats::Strings,
|
97
|
-
xml: Phrase::Formats::Xml,
|
98
|
-
tmx: Phrase::Formats::Tmx,
|
99
|
-
xlf: Phrase::Formats::Xliff,
|
100
|
-
yml: Phrase::Formats::Yaml,
|
101
|
-
yml_symfony: Phrase::Formats::YamlSymfony,
|
102
|
-
yml_symfony2: Phrase::Formats::YamlSymfony2,
|
103
|
-
php_array: Phrase::Formats::PhpArray,
|
104
|
-
laravel: Phrase::Formats::Laravel,
|
105
|
-
angular_translate: Phrase::Formats::AngularTranslate,
|
106
|
-
mozilla_properties: Phrase::Formats::MozillaProperties,
|
107
|
-
play_properties: Phrase::Formats::PlayProperties,
|
108
|
-
}
|
109
|
-
|
110
|
-
def self.config
|
111
|
-
Phrase::Tool.config
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.custom_handler
|
115
|
-
handler_class_for_format(:custom)
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.target_directory(format_name)
|
119
|
-
handler = handler_class_for_format(format_name)
|
120
|
-
custom_handler.target_directory || handler.target_directory
|
121
|
-
end
|
122
|
-
|
123
|
-
def self.directory_for_locale_in_format(locale, format_name)
|
124
|
-
handler = handler_class_for_format(format_name)
|
125
|
-
custom_directory = custom_handler.directory_for_locale(locale, format_name)
|
126
|
-
custom_directory || handler.directory_for_locale(locale)
|
127
|
-
end
|
128
|
-
|
129
|
-
def self.filename_for_locale_in_format(locale, format_name)
|
130
|
-
handler = handler_class_for_format(format_name)
|
131
|
-
custom_filename = custom_handler.filename_for_locale(locale, format_name)
|
132
|
-
custom_filename || handler.filename_for_locale(locale)
|
133
|
-
end
|
134
|
-
|
135
|
-
def self.file_format_exposes_locale?(file_path, format_name=nil)
|
136
|
-
format = format_name || guess_possible_file_format_from_file_path(file_path)
|
137
|
-
format.nil? ? false : handler_class_for_format(format).locale_aware?
|
138
|
-
end
|
139
|
-
|
140
|
-
def self.detect_locale_name_from_file_path(file_path, format_name=nil)
|
141
|
-
format = format_name || guess_possible_file_format_from_file_path(file_path)
|
142
|
-
format.nil? ? nil : handler_class_for_format(format).extract_locale_name_from_file_path(file_path)
|
143
|
-
end
|
144
|
-
|
145
|
-
def self.format_renders_locale_as_extension?(format)
|
146
|
-
if format.present?
|
147
|
-
format_class = handler_class_for_format(format)
|
148
|
-
format_class.renders_locale_as_extension?
|
149
|
-
else
|
150
|
-
false
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def self.handler_class_for_format(format_name)
|
155
|
-
SUPPORTED_FORMATS.fetch(format_name.to_sym)
|
156
|
-
end
|
157
|
-
private_class_method :handler_class_for_format
|
158
|
-
|
159
|
-
def self.guess_possible_file_format_from_file_path(file_path)
|
160
|
-
extension = extension_from_file_path(file_path)
|
161
|
-
possible_format = SUPPORTED_FORMATS.keys.find do |format|
|
162
|
-
SUPPORTED_FORMATS[format].send(:supports_extension?, extension)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
private_class_method :guess_possible_file_format_from_file_path
|
166
|
-
|
167
|
-
def self.extension_from_file_path(file_path)
|
168
|
-
file_path.split('.').last.downcase
|
169
|
-
end
|
170
|
-
private_class_method :extension_from_file_path
|
171
|
-
end
|
172
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
module Phrase
|
4
|
-
module Formats
|
5
|
-
class AngularTranslate < Phrase::Formats::Base
|
6
|
-
def self.filename_for_locale(locale)
|
7
|
-
"phrase.#{locale.name}.json"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.locale_aware?
|
11
|
-
false
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.extensions
|
15
|
-
[:json]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/phrase/formats/csv.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
module Phrase
|
4
|
-
module Formats
|
5
|
-
class Csv < Phrase::Formats::Base
|
6
|
-
def self.filename_for_locale(locale)
|
7
|
-
"phrase.#{locale.name}.csv"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.locale_aware?
|
11
|
-
false
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.extensions
|
15
|
-
[:csv]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
class Phrase::Formats::Custom < Phrase::Formats::Base
|
4
|
-
def self.directory_for_locale(locale, format)
|
5
|
-
setting = config.locale_directory
|
6
|
-
return unless setting
|
7
|
-
parse(setting, locale, format)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.filename_for_locale(locale, format)
|
11
|
-
setting = config.locale_filename
|
12
|
-
return unless setting
|
13
|
-
parse(setting, locale, format)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.target_directory
|
17
|
-
config.target_directory
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.parse(str, locale, format)
|
21
|
-
str.gsub(/#{regexp(locale, format)}/) do |match|
|
22
|
-
replacements(locale, format)[match]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
private_class_method :parse
|
26
|
-
|
27
|
-
def self.regexp(locale, format)
|
28
|
-
"(#{replacements(locale, format).keys.join('|')})"
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.replacements(locale, format)
|
32
|
-
{
|
33
|
-
'<domain>' => config.domain,
|
34
|
-
'<format>' => format,
|
35
|
-
'<locale.name>' => locale.name,
|
36
|
-
'<locale.code>' => locale.code,
|
37
|
-
'<locale>' => locale.name
|
38
|
-
}
|
39
|
-
end
|
40
|
-
end
|