React - i18next-extract: Question about extractedTranslations output - reactjs

I'm using this babel plugin https://github.com/gilbsgilbs/babel-plugin-i18next-extract. Haven't configured it much beyond the basics.
it generates an extractedTranslations folder but I just end up with keys and no values. Is that the correct behavior? I would figure that it would reconcile the values from the translations files that i already have.. I'm kind of confused on how this is useful?

Creator of the plugin here. By default, babel-plugin-i18next-extract indeed extracts the keys to extractedTranslations/{{locale}}/{{ns}}.json. If you want to change this, you must set the outputPath configuration option to something else. For instance:
{
"plugins": [
[
"i18next-extract",
{
"outputPath": "locales/{{locale}}/{{ns}}.json"
}
]
]
}
If the outputPath you set already exists for a given locale and namespace, the plugin should only add new keys and leave the values of existing keys untouched.
You may want to look at the other configuration options to make the plugin match to your workflow.

Related

Want to pass in a string array into a WS.sendRequest using groovy

I am new to API testing and am using Katalon to develop the tests. I've Googled any question I could think of and couldn't find anything to answer my question.
We have an API with the following Body
[
"${idValue1}",
"${idValue2}",
"${idValue3}",
"${idValue4}",
"${idValue5}",
]
I believe the purpose of this one is to delete multiple records at once by id. The script that we have in the step definition is
response = WS.sendRequest(findTestObject('EquipmentAPI/data-objects/DELETE Equipment By Ids', [('host') : GlobalVariable.host, ('idValues') : GlobalVariable.equipId]))
GlobalVariable.equipId = WS.getElementPropertyValue(response, 'data[0].id')
There are other step definitions that run before this one to set the Global Variables for use. I was able to generate the string array without issue.
Is this something that's possible? Please help!
Please let me know if further information is needed. Thanks.

Janusgraph how to deal with the global_offline misconfiguration

when i tired to remove an index, I typed wrong GLOBAL_OFFLINE setting in userConfig in the ManagementSystem, which I mistake typed the "index.search.backend" with a directory string ......
when i try to open this janusgraph, the print out as below :
WARN org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration
Local setting index.search.backend=lucene (Type: GLOBAL_OFFLINE) is overridden by globally managed value (/data/lucene). Use the ManagementSystem interface instead of the local configuration to control this setting.
INFO org.janusgraph.diskstorage.Backend - Configuring index [search]
Could not find implementation class: /data/lucene
I wonder whether i could not drop this table at the backend and fix this problem !
many thx !
I think i have fix this problem !
I just use the KCVS backend , and find out the source code of GraphDatabaseConfiguration ;
I tried and get the KCVSConfig use the code following :
PropertiesConfiguration configuration = new PropertiesConfiguration(GRAPH_PROPERTIES);
ReadConfiguration localConfig = new CommonsConfiguration(configuration);
BasicConfiguration localBasicConfiguration = new BasicConfiguration(ROOT_NS,localConfig, BasicConfiguration.Restriction.NONE);
KeyColumnValueStoreManager storeManager = Backend.getStorageManager(localBasicConfiguration);
KCVSConfiguration KCVSConfig =Backend.getStandaloneGlobalConfiguration(storeManager,localBasicConfiguration);
Just using the KCVSConfiguration to remove all the index configuration !

In drupal7, how can i use varibles when exporting configuration using features and strongarm modules?

I am working on a drupal7 site.
In Dev, I have enabled and configured simplesamlphp_auth module.
I used features and strongarm to export the configuration to code.
The downloaded feature contain:
myfeature_sso.features.defaultconfig.inc
myfeature_sso.info
myfeature_sso.module
The .inc file contains the configuration values I had put in (admin/config/people/simplesamlphp_auth) correctly
Now, in a few places, I want to replace the hard coded values with variables that change based on the environment. I set the variables at the top of .inc file using variable_get $office_ou = variable_get('office_ou', NULL); ...and . A quick example is $base_url below:
$strongarm = new stdClass();
$strongarm->disabled = FALSE;
$strongarm->api_version = 1;
$strongarm->name = 'simplesamlphp_auth_logoutgotourl';
$strongarm->value = $base_url ;
$export['simplesamlphp_auth_logoutgotourl'] = $strongarm;
When I DPM these variables, they display correct values.
But on a fresh install when I enable myfeature_sso module the value of variables are missing.
missing value from $base_url variable
Can you please point me in the right direction?
Thank you.
I found the answer:
when in features ui, do not add fields relevant to simplesamle to the defaultconfig section. if you have any there remove them.
add fields relevant to simplesaml to storongarm section
export the feature
in your_feature_name.strongarm.inc add any additional php code to function your_feature_name_strongarm()
done

How to read config files on elixir mix project

I am creating an elixir project to search for patterns in files.
I want to store those patterns a config files to allow for easy changes in the app.
My first idea is storing those files as exs files in the config folder in the mix project.
So, the questions are:
Is there any easy way to store the config in the files a a keyword list?
How would I load it in the app?
I see there are modules like File to read the file, but is there no standard way to parse keyword lists in elixir? I was thinking something similar as the yml files in Rails.
You can read keyword lists stored in a *.exs file, using Mix.Config.read(path). For writing Elixir terms to a *.exs file, you can use Inspect.Algebra.to_doc(%Inspect.Opts{pretty: true}) and write the resulting string content to a file using File.write. It's not as well formatted as if you did it by hand, but it's definitely still readable.
If you don't mind using Erlang terms, you can read and write those easily using :file.consult(path) and :file.write_file(:io_lib.fwrite('~p.\n', [config]), path) respectively.
Using Code.eval_file
Adding another option, is to evaluate the file as a code file, using Code.eval_file and get in return the result as an elixir construct.
Config file config1.ex:
%{configKey1: "configValue1", configKey2: "configValue2"}
Reading the file:
{content, _} = Code.eval_file("config1.ex")
*evaluating a code file has security consideration needs to take in mind.
Regarding using Mix.Config.read! in #bitwalker correct answer
the config file needs to be in a specific format of:
[
appName: [key1: "val1", key2: "val2"]
]
In the Mix.Config.read code, it try to validate the contents and expect a main keyword list [ {}, {}.. ] which includes keys that has value of type keyword list also.
The code is not long:
def validate!(config) do
if is_list(config) do
Enum.all?(config, fn
{app, value} when is_atom(app) ->
if Keyword.keyword?(value) do
true
else
raise ArgumentError,
"expected config for app #{inspect app} to return keyword list, got: #{inspect value}"
end
_ ->
false
end)
else
raise ArgumentError,
"expected config file to return keyword list, got: #{inspect config}"
end
end
We can circumvent and use a first key which is not atom, and then the validate stops but does not throw:
[
{"mockFirstKey", "mockValue"},
myKey1: "myValue1",
myKey2: "myValue2"
]

Error: Variantoptimizer: No default case found for (qx.debug:off)

When trying to generate our application with the variant "qx.debug" set to "on" in the config.json I get a lot of errors like this:
Error: Variantoptimizer: No default case found for (qx.debug:off) at (qx.core.Property:1004)
I could fix those by adding the "default" cases, but I was wondering, if I was doing something wrong in the first place or if this these are actual issues in the qooxdoo SDK.
For one thing, qx.debug is set to "on" in the source version by default, so you don't have to do anything for that.
For the build version, you need to configure this in your config.json, e.g. in the "jobs" section add
"build" : {
"variants" : {
"=qx.debug" : [ "on" ]
}
}
Is this what your config looks like? The error message you gave is weird, which qooxdoo version are you using? You shouldn't need to provide any "default" cases for this variant in the framework code.

Resources