I have problem with using I18n _() in Symfony 1.4 action.
In component where I call _('test',null,'translation') I get 'abcd' but when I call it in action I get 'test'. This indicate that it is not the problem with xliff file.
In settings.yml there is i18n on
all:
.actions:
error_404_module: errors # To be called when a 404 error is raised
error_404_action: error404 # Or when the requested URL doesn't match any route
#
login_module: default # To be called when a non-authenticated user
login_action: login # Tries to access a secure page
#
secure_module: default # To be called when a user doesn't have
secure_action: secure # The credentials required for an action
#
# module_disabled_module: default # To be called when a user requests
# module_disabled_action: disabled # A module disabled in the module.yml
#
.settings:
i18n: on
The problem not even resolve adding to the action
sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
Try this way:
$this->getContext()->getI18N()->__($text, $args, 'translation');
Related
I am using sphinx for building documentation in confluence.I am able to make html file using sphinx. But when I am trying to connect confluence using the "make confluence" command it's throwing an error
I checked by changing the confluence password and checked using API token still getting the error and unable to connect with confluence.
Ref link-
https://github.com/Shravankumarhiregoudar/sphinxDocumentation
conf.py file:
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.append('/home/4px/sphinx/scripts/')
# -- Project information -----------------------------------------------------
project = 'sites'
copyright = '2021, divyank'
author = 'divyank'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinxcontrib.confluencebuilder'
]
confluence_publish = True
confluence_space_name = 'Documentation'
##confluence_ask_password = True
#confluence_parent_name = 'API Documentation'
# (for Confluence Cloud)
confluence_server_url = 'https://<....>.atlassian.net/wiki/spaces'
confluence_server_user = '<....>'
confluence_server_pass = '<.......>'
# (or, for Confluence Server)
#confluence_server_url = 'https://intranet-wiki.example.com/'
#confluence_server_user = 'myawesomeuser'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns=[]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
'preamble': '',
# Latex figure (float) alignment
'figure_align': 'htbp',
}
Error:
WARNING: normalizing confluence url from https://<......>.atlassian.net/wiki/ to https://<.......>.atlassian.net/wiki/
sphinxcontrib.confluencebuilder error:
---
Unable to authenticate with the Confluence server.
Ensure your username and password are correct. If your username and password is correct, you may need to unlock your Confluence account be re-logging in with your browser or asking your Confluence administrator for help.
---
make: *** [confluence] Error 2
I am able to resolve this issue using API token in the confluence password field in conf.py file.
How to generate API token-
Manage API tokens for your Atlassian account
Ref link-
Unable to authenticate with the Confluence server using sphinxcontrib.confluencebuilder
I have made a basic install of a hyperstack rails app using hyperstack.org's installation instructions, trying to add a HTTP.get request in an after_mount callback.
Not really sure what else I could try, thought HTTP would be a standard option
class App < HyperComponent
include Hyperstack::Router
after_mount do
HTTP.get('/example.json')
end
render do
DIV() do
'App'
# NodeDisplay
# define routes using the Route psuedo component. Examples:
# Route('/foo', mounts: Foo) : match the path beginning with /foo and mount component Foo here
# Route('/foo') { Foo(...) } : display the contents of the block
# Route('/', exact: true, mounts: Home) : match the exact path / and mount the Home component
# Route('/user/:id/name', mounts: UserName) : path segments beginning with a colon will be captured in the match param
# see the hyper-router gem documentation for more details
end
end
end
the error received is:
Uncaught error: HTTP: uninitialized constant App::HTTP
in App (created by Hyperstack::Internal::Component::TopLevelRailsComponent)
in Hyperstack::Internal::Component::TopLevelRailsComponent
Simple answer: The HTTP library is not by default included in Opal or Hyperstack.
You can include it as part of the Opal jQuery wrapper, or with a minimal Opal Browser::HTTP library.
To add the jQuery wrapper to your Hyperstack application do the following:
Import the Hypestack jquery wrapper by adding
import 'hyperstack/component/jquery', client_only: true
to your config/initializers/hyperstack.rb file.
Then include the actual jquery javascript code in your assets:
If using webpacker run yarn add jquery in your terminal, and then add this line to the javascripts/packs/client_only.js file:
jQuery = require('jquery');
If not using webpacker instead add import 'jquery', client_only: true to the hyperstack initializer file.
If you just want to use the more minimal Browser::HTTP module, add
import 'browser/http
to your config/initializers/hyperstack.rb file.
After changing your hyperstack.rb you will have to clear the rails tmp cache by running rm -rf tmp/cache
Note: When using the browser version you will need to use Browser::HTTP instead of simply HTTP.
There are so many posts describing this same error, and I have tried to read them all to find out exactly what is causing my error.
I have tried mangling this file eleven different ways, even reverting it back to the original file - still no luck. What am I missing?
The error is supposedly on "line 3 column 22" - which does not exist. I have no jekyll parser on the client side, everything is being handled through GitHub Pages.
https://github.com/drovani/drovani.github.io/commits/master/_config.yml
#
# This file contains configuration flags to customize your site
#
# Name of your site (displayed in the header)
name: "Rovani in C#"
# Short bio or description (displayed in the header)
description: "Ostinato, Pensato, Scordatura"
# URL of your avatar or profile pic (you could use your GitHub profile pic)
avatar: https://avatars3.githubusercontent.com/u/898478
#
# Flags below are optional
#
# Includes an icon in the footer for each username you enter
footer-links:
dribbble:
email: dev#rovani.net
facebook:
flickr:
github: drovani
instagram:
linkedin:
pinterest:
rss: # just type anything here for a working RSS icon
twitter: davidrovani
stackoverflow: "users/28310/drovani"
youtube: # channel/<your_long_string> or user/<user-name>
googleplus: # anything in your profile username that comes after plus.google.com/
# Enter your Disqus shortname (not your username) to enable commenting on posts
# You can find your shortname on the Settings page of your Disqus account
disqus: drovani
# Enter your Google Analytics web tracking code (e.g. UA-2110908-2) to activate tracking
google_analytics: UA-82341148-1
# Your website URL (e.g. http://barryclark.github.io or http://www.barryclark.co)
# Used for Sitemap.xml and your RSS feed
url:
# If you're hosting your site at a Project repository on GitHub pages
# (http://yourusername.github.io/repository-name)
# and NOT your User repository (http://yourusername.github.io)
# then add in the baseurl here, like this: "/repository-name"
baseurl: ""
#
# !! You don't need to change any of the configuration flags below !!
#
permalink: /:title/
# The release of Jekyll Now that you're using
version: v1.2.0
# Jekyll 3 now only supports Kramdown for Markdown
kramdown:
# Use GitHub flavored markdown, including triple backtick fenced code blocks
input: GFM
# Jekyll 3 and GitHub Pages now only support rouge for syntax highlighting
syntax_highlighter: rouge
syntax_highlighter_opts:
# Use existing pygments syntax highlighting css
css_class: 'highlight'
# Set the Sass partials directory, as we're using #imports
sass:
style: :expanded # You might prefer to minify using :compressed
# Use the following plug-ins
gems:
- jekyll-sitemap # Create a sitemap using the official Jekyll sitemap gem
- jekyll-feed # Create an Atom feed using the official Jekyll feed gem
# Exclude these files from your production _site
exclude:
- Gemfile
- Gemfile.lock
- LICENSE
- README.md
- CNAME
Instead of the issue being in the _config.yml file, it was in a completely different file altogether. So, if you get this error message from building a github-pages Jekyll page, don't assume that it is in the only "YAML" file. Search any new file that you have added for a Line 3 Column 22 and that will track down the error.
In my case, it was a title for a post in the front matter had a colon with a space after it - which I needed to put double-quotes around.
I have this code
<iframe src="http://matrix.crebtools.com/Matrix/public/IDX.aspx?idx=5a251ec" width="860px" height="520px"></iframe>
It work locally but its not working on heroku
On heroku it shows white empty space
so i put in application.rb this code but its still not working
In applications.rb
module MohamedHatata
class Application < Rails::Application
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
I spend two days just to try figure out the solution please any one help me
This is my website
https://mohamed-hatata.herokuapp.com/downsizes/new
If you open your javascript console you will find mixed content warning.
Mixed Content: The page at
'https://mohamed-hatata.herokuapp.com/downsizes/new' was loaded over
HTTPS, but requested an insecure resource
'http://matrix.crebtools.com/Matrix/public/IDX.aspx?idx=5a251ec'. This
request has been blocked; the content must be served over HTTPS.
If you visit your site at http://mohamed-hatata.herokuapp.com/downsizes/new instead of https://mohamed-hatata.herokuapp.com/downsizes/new your iframe loads fine.
config.action_dispatch.default_headers is to be set by the site which is getting loaded inside your application and not by your application itself.
Read more on Mixed Content - https://developer.mozilla.org/en/docs/Security/MixedContent
I am working in rails 4 and I am trying to authenticate using github. So in my Github application I have this:
URL: http:// localhost:4000
Callback URL: http:// localhost:4000/auth/github/callback
The callback url is the url that Github will try to reach when the authentication is done right?
So why do I get a Github page 404 error when I click on my link:
<%= link_to 'Sign in with Github', '/auth/github' %>
I am working on a localhost development enviroment so that might be the problem?
Also when i type http:// localhost:4000/auth/github/callback on my browser I get an OmniAuth::Strategies::OAuth2::CallbackError
why? I have this in my routes.rb
post 'auth/:provider/callback' => 'home#index'
Is Rails 4 and Omniauth bugged?
(added the space in localhost so stackoverflow accepts my post)
I have github working with the gem omniauth-github
and a file config/initializers/omniauth.rb containing
Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
end
However, when I enter http://localhost:3000/auth/github/callback on my browser I also get OmniAuth::Strategies::OAuth2::CallbackError so this shouldn't be the problem.
My config/environment.rb looks like
# Load the rails application
require File.expand_path('../application', __FILE__)
# Load the app's custom environment variables here, so that they are loaded before environments/*.rb
app_environment_variables = File.join(Rails.root, 'config', 'app_environment_variables.rb')
load(app_environment_variables) if File.exists?(app_environment_variables)
...
and my config/app/environment_variables.rb looks like
# OAuth Keys and Secrets
if Rails.env.production?
ENV['GITHUB_KEY'] = 'd1234a3a123a1a3a123c'
ENV['GITHUB_SECRET'] = '1234azer123azer1231209jeunsghezkndaz1234'
else
ENV['GITHUB_KEY'] = 'qsflkjkj685bg554456b'
ENV['GITHUB_SECRET'] = 'qslkfj7757kqfmlsdh675hlfsd587kjfdh687jsd'
end
See Is it possible to set ENV variables for rails development environment in my code? for more details on that.
I have 2 applications registered on github. One app_name-dev with key qsflk..., url http://localhost:3000 and callback url http://localhost:3000/auth/github/callback and one app_name with key d1234a....
Check that you have done that correctly. Maybe try to change localhost to 127.0.0.1.
For me it was Github's new stricter URI matching that was producing a 404 when trying to redirect to http://localhost:3000/auth/github/callback, I solved it by passing the redirect URI as a parameter with Omniauth.
Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'],
:scope => 'user,public_repo',
:redirect_uri => ENV['GITHUB_REDIRECT']
end
If your on Linux/Mac you can add environment variables from the command line.
$ export GITHUB_REDIRECT=http://localhost:3000/auth/github/callback
Alternatively, you could use something like Foreman that will let you add a .env file which you can use to store your variables in.
Just remember to add the appropriate redirect URI to your production environment's variables, and you're good, to go.